/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #475569;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1a202c 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 20px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--surface-light);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.connection-status.connected {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.connection-status i {
    font-size: 1.2rem;
}

/* Connection Panel */
.connection-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.panel-content i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.panel-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.panel-content p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    background: transparent;
    color: var(--text);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    border: 1px solid var(--border);
    background: var(--surface-light);
}

.btn-outline:hover {
    background: var(--border);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Alerts */
.firmware-alert {
    margin-bottom: 30px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.alert i {
    font-size: 1.5rem;
}

.alert h3 {
    margin-bottom: 5px;
    color: var(--text);
}

.alert p {
    color: var(--text-muted);
    margin: 0;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 8px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--surface-light);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow);
}

.tab-btn i {
    font-size: 1.1rem;
}

/* Tab Content */
.tab-content {
    min-height: 500px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--surface-light), var(--surface));
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 600;
}

.card-header i {
    color: var(--primary);
}

.card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
}

.status-success {
    background: var(--success);
}

.admin-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
}

.card-body {
    padding: 30px;
}

/* Forms */
.form-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-group label i {
    color: var(--primary);
    width: 16px;
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-input, .form-select {
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.password-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* Sliders */
.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider {
    flex: 1;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow);
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Flash Section */
.flash-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.firmware-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius);
}

.firmware-info i {
    font-size: 1.5rem;
    color: var(--primary);
}

.firmware-info h3 {
    margin-bottom: 5px;
    color: var(--text);
}

.firmware-info p {
    color: var(--text-muted);
    margin: 0;
}

/* Progress */
.flash-progress {
    padding: 20px;
    background: var(--surface-light);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Terminal */
.terminal {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: var(--radius);
    padding: 20px;
    height: 400px;
    overflow-y: auto;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
}

.terminal-line {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.timestamp {
    color: #7c3aed;
    font-weight: 500;
}

.message {
    color: #e5e7eb;
}

.terminal-input {
    display: flex;
    gap: 10px;
}

.terminal-input .form-input {
    flex: 1;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.monitor-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .tab-nav {
        flex-direction: column;
    }
    
    .tab-btn {
        justify-content: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
    
    .card-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .alert {
        flex-direction: column;
        text-align: center;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}