/* Загальні стилі */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.95em;
}

.status-bar {
    padding: 15px 30px;
    margin: 0;
    background: #f0f0f0;
    border-left: 4px solid #667eea;
}

.status-bar.success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.status-bar.error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.status-bar.warning {
    background: #fff3cd;
    border-left-color: #ff9800;
    color: #856404;
}

main {
    padding: 30px;
}

/* Вкладки */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: #667eea;
    background: #f8f9fa;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.card h2 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    background: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* API key field */
.card-api-key {
    background: linear-gradient(135deg, #f8f9ff 0%, #f3eef8 100%);
    border-color: #d4d8f0;
}

.card-api-key code {
    font-size: 0.9em;
    background: rgba(102, 126, 234, 0.12);
    color: #4c51bf;
    padding: 1px 6px;
    border-radius: 4px;
}

.input-with-action {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-with-action:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.input-with-action input[type="password"],
.input-with-action input[type="text"] {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.95em;
    letter-spacing: 0.02em;
    min-width: 0;
}

.btn-input-action {
    flex-shrink: 0;
    width: 48px;
    border: none;
    border-left: 1px solid #e8e8ef;
    background: #f5f6fb;
    cursor: pointer;
    font-size: 1.15em;
    line-height: 1;
    color: #555;
    transition: background 0.2s, color 0.2s;
}

.btn-input-action:hover {
    background: #e8eaf6;
    color: #667eea;
}

.btn-input-action:active {
    background: #dde0f5;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.section-hint {
    margin-bottom: 16px;
    color: #666;
    font-size: 0.95em;
}

.actions-left {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 10px;
}

.response-log {
    margin-top: 16px;
    padding: 14px;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    font-size: 0.85em;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 80px;
    max-height: 280px;
    overflow: auto;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.form-group small a {
    color: #667eea;
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.status-label {
    font-weight: 600;
    color: #555;
}

.status-value {
    color: #333;
    font-weight: 500;
}

.status-value.ok {
    color: #28a745;
}

.status-value.error {
    color: #dc3545;
}

.status-value.warning {
    color: #ff9800;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9em;
}

/* Стилі для сканування принтерів */
.scan-status {
    margin-left: 15px;
    color: #666;
    font-size: 0.9em;
}

.scan-status.scanning {
    color: #667eea;
}

.scan-status.success {
    color: #28a745;
}

.scan-status.error {
    color: #dc3545;
}

.printers-list {
    min-height: 100px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

.printer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.printer-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.printer-info {
    flex: 1;
}

.printer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.printer-ip {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.printer-port {
    color: #666;
    font-size: 0.9em;
}

.btn-test-print {
    padding: 8px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-test-print:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-test-print:active {
    transform: translateY(0);
}

.btn-test-print:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-settings {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-settings:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-settings:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        margin: 10px;
        border-radius: 8px;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 1.5em;
    }

    main {
        padding: 20px;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .printer-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .printer-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

