/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Navigation */
.tab-nav {
    display: flex;
    background: white;
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tab-btn i {
    font-size: 1rem;
}

/* Main Content */
main {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.card h2 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 {
    color: #6c757d;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* Forms */
.form-section {
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input: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.1);
}

.form-group textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.radio-label:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

.radio-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

/* API Key Table */
.api-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.api-table th,
.api-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.api-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.api-table tr:hover {
    background: #f8f9fa;
}

.api-table .api-key-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #6c757d;
}

.api-table .actions-cell {
    display: flex;
    gap: 5px;
}

.api-table .btn-small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

/* Progress */
.progress-section {
    margin-top: 30px;
}

.progress-info {
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* Logs */
.log-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.log-container {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.log-content {
    height: 400px;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 4px;
}

.log-entry.success {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
}

.log-entry.error {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
}

.log-entry.info {
    background: rgba(102, 126, 234, 0.1);
    color: #004085;
}

.log-timestamp {
    color: #6c757d;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tab-nav {
        flex-direction: column;
        gap: 5px;
    }
    
    .tab-btn {
        width: 100%;
    }
    
    main {
        padding: 20px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .api-table {
        font-size: 0.8rem;
    }
    
    .api-table th,
    .api-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .tab-btn {
        padding: 12px 15px;
        font-size: 0.8rem;
    }
    
    main {
        padding: 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .log-content {
        height: 300px;
        font-size: 0.8rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    main {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .card {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .card h2,
    .card h3 {
        color: #ecf0f1;
    }
    
    .form-group label {
        color: #ecf0f1;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #2c3e50;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .api-table th {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .api-table tr:hover {
        background: #2c3e50;
    }
    
    .log-container {
        background: #2c3e50;
        border-color: #4a5f7a;
    }
    
    .log-content {
        background: #34495e;
        color: #ecf0f1;
    }
}