/* ===================================
   Monitor de Edital - Asas para Todos
   Tema: Aviação Profissional
   =================================== */

/* Paleta de Cores - Tema Aviação */
:root {
    /* Azuis profundos */
    --primary-dark: #0B1F3F;
    --primary: #1E3A5F;
    --primary-light: #2C5282;

    /* Cinzas e Brancos */
    --bg-light: #F7FAFC;
    --bg-white: #FFFFFF;
    --gray-50: #F7FAFC;
    --gray-100: #EDF2F7;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E0;
    --gray-600: #718096;
    --gray-700: #4A5568;
    --gray-900: #1A202C;

    /* Acentos - Alertas (Amarelo/Laranja) */
    --accent-warning: #F59E0B;
    --accent-alert: #EF4444;
    --accent-success: #10B981;
    --accent-info: #3B82F6;

    /* Sistema */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-width: 240px;
    --header-height: 70px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 14px;
    overflow-x: hidden;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary-dark);
    color: white;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-container {
    max-width: 100%;
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    margin-right: 12px;
    border-radius: 6px;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    color: var(--accent-warning);
}

.header-titles h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.header-titles p {
    font-size: 13px;
    opacity: 0.8;
    font-weight: 400;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.status-pulse {
    width: 10px;
    height: 10px;
    background: var(--gray-600);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-pulse.active {
    background: var(--accent-success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 13px;
    font-weight: 500;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 85;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Main Container */
.main-container {
    margin-top: var(--header-height);
    display: flex;
    min-height: calc(100vh - var(--header-height));
    flex-direction: row;
}

/* Content Wrapper - envolve main-content e footer */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.nav-btn svg {
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--gray-200);
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-start {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    color: white;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-stop {
    background: linear-gradient(135deg, var(--accent-alert) 0%, #DC2626 100%);
    color: white;
}

.btn-stop:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
}

/* Content Views */
.content-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* Section Header */
.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.section-header p {
    color: var(--gray-600);
    font-size: 14px;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.status-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.status-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-card.primary .card-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.status-card.accent .card-icon {
    background: linear-gradient(135deg, var(--accent-warning) 0%, #D97706 100%);
    color: white;
}

.status-card.success .card-icon {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    color: white;
}

.status-card.info .card-icon {
    background: linear-gradient(135deg, var(--accent-info) 0%, #2563EB 100%);
    color: white;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.card-value.small {
    font-size: 16px;
    font-weight: 600;
}

/* Activity Feed */
.activity-feed {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-height: 300px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--gray-50);
    margin-bottom: 12px;
    transition: var(--transition);
    border-left: 3px solid var(--accent-info);
}

.activity-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.activity-item.warning {
    border-left-color: var(--accent-warning);
}

.activity-item.alert {
    border-left-color: var(--accent-alert);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
    box-shadow: var(--shadow-sm);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.activity-meta {
    font-size: 13px;
    color: var(--gray-600);
}

.activity-link {
    margin-top: 8px;
}

.activity-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.activity-link a:hover {
    color: var(--primary-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-600);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.empty-state small {
    font-size: 13px;
    color: var(--gray-600);
}

/* Forms */
.config-form {
    max-width: 900px;
}

.form-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

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

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.form-label svg {
    opacity: 0.6;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    transition: var(--transition);
    background: white;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-textarea {
    resize: vertical;
    font-family: 'Monaco', 'Menlo', monospace;
    line-height: 1.5;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--gray-600);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.btn-primary,
.btn-secondary,
.btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-clear {
    background: transparent;
    color: var(--gray-600);
    padding: 8px 12px;
}

.btn-clear:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 12px;
    transition: var(--transition);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

input[type="checkbox"]:checked + .toggle-switch {
    background: var(--accent-success);
}

input[type="checkbox"]:checked + .toggle-switch::before {
    left: 22px;
}

.toggle-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

/* Alerts */
.alert-info,
.alert-warning {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-info {
    background: #EFF6FF;
    border-left: 3px solid var(--accent-info);
}

.alert-warning {
    background: #FFFBEB;
    border-left: 3px solid var(--accent-warning);
}

.alert-info svg {
    flex-shrink: 0;
    color: var(--accent-info);
}

.alert-warning svg {
    flex-shrink: 0;
    color: var(--accent-warning);
}

.alert-info strong,
.alert-warning strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--gray-900);
}

.alert-info p,
.alert-warning p {
    font-size: 13px;
    color: var(--gray-700);
    margin: 0;
}

.alert-warning ol {
    margin-top: 8px;
    margin-left: 16px;
    font-size: 13px;
    color: var(--gray-700);
}

.alert-warning li {
    margin: 4px 0;
}

/* Logs */
.logs-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.logs-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
}

.logs-container {
    padding: 16px;
    background: #0D1117;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.logs-empty {
    text-align: center;
    padding: 60px 20px;
    color: #8B949E;
}

.log-entry {
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 4px;
    background: #161B22;
    border-left: 3px solid;
}

.log-entry.INFO {
    border-left-color: var(--accent-info);
}

.log-entry.SUCESSO {
    border-left-color: var(--accent-success);
}

.log-entry.ALERTA {
    border-left-color: var(--accent-warning);
}

.log-entry.ERRO {
    border-left-color: var(--accent-alert);
}

.log-timestamp {
    color: #8B949E;
    margin-right: 8px;
}

.log-type {
    font-weight: 700;
    margin-right: 8px;
}

.log-type.INFO { color: var(--accent-info); }
.log-type.SUCESSO { color: var(--accent-success); }
.log-type.ALERTA { color: var(--accent-warning); }
.log-type.ERRO { color: var(--accent-alert); }

.log-message {
    color: #C9D1D9;
}

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

.logs-container::-webkit-scrollbar-track {
    background: #0D1117;
}

.logs-container::-webkit-scrollbar-thumb {
    background: #30363D;
    border-radius: 4px;
}

.logs-container::-webkit-scrollbar-thumb:hover {
    background: #484F58;
}

/* Responsive */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        z-index: 90;
        transform: translateX(-100%);
        transition: var(--transition);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-titles h1 {
        font-size: 16px;
    }

    .header-titles p {
        display: none;
    }

    .main-content {
        padding: 20px 16px;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 20px;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
}

/* ===================================
   MODO ESCURO
   =================================== */

body.dark-mode {
    background: #0d1117;
    color: #c9d1d9;
}

/* Header no modo escuro */
body.dark-mode .main-header {
    background: #010409;
    border-bottom: 1px solid #30363d;
}

/* Sidebar no modo escuro */
body.dark-mode .sidebar {
    background: #0d1117;
    border-right: 1px solid #30363d;
}

body.dark-mode .nav-btn {
    color: #8b949e;
}

body.dark-mode .nav-btn:hover {
    background: #161b22;
    color: #c9d1d9;
}

body.dark-mode .nav-btn.active {
    background: #1f6feb;
    color: white;
}

/* Cards no modo escuro */
body.dark-mode .status-card {
    background: #161b22;
    border-color: #30363d;
}

body.dark-mode .card-label {
    color: #8b949e;
}

body.dark-mode .card-value {
    color: #c9d1d9;
}

/* Forms no modo escuro */
body.dark-mode .form-card {
    background: #161b22;
    border-color: #30363d;
}

body.dark-mode .form-input,
body.dark-mode .form-textarea {
    background: #0d1117;
    border-color: #30363d;
    color: #c9d1d9;
}

body.dark-mode .form-input:focus,
body.dark-mode .form-textarea:focus {
    border-color: #1f6feb;
    background: #010409;
}

body.dark-mode .form-label {
    color: #c9d1d9;
}

body.dark-mode .form-hint {
    color: #8b949e;
}

/* Buttons no modo escuro */
body.dark-mode .btn-primary {
    background: #1f6feb;
}

body.dark-mode .btn-primary:hover {
    background: #1a5cd6;
}

body.dark-mode .btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border-color: #30363d;
}

body.dark-mode .btn-secondary:hover {
    background: #30363d;
}

/* Mobile menu button no modo escuro */
body.dark-mode .mobile-menu-btn {
    color: #c9d1d9;
}

body.dark-mode .mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Activity Feed no modo escuro */
body.dark-mode .activity-feed {
    background: #161b22;
    border-color: #30363d;
}

body.dark-mode .empty-state {
    color: #8b949e;
}

body.dark-mode .empty-state svg {
    stroke: #30363d;
}

/* Alerts no modo escuro */
body.dark-mode .alert-info {
    background: #0c2d6b;
    border-left-color: #1f6feb;
}

body.dark-mode .alert-warning {
    background: #4d2d00;
    border-left-color: #f59e0b;
}

body.dark-mode .alert-info strong,
body.dark-mode .alert-warning strong,
body.dark-mode .alert-info p,
body.dark-mode .alert-warning p,
body.dark-mode .alert-warning li {
    color: #c9d1d9;
}

/* Section headers no modo escuro */
body.dark-mode .section-header h2 {
    color: #c9d1d9;
}

body.dark-mode .section-header p {
    color: #8b949e;
}

/* Headers e títulos no modo escuro */
body.dark-mode h3 {
    color: #c9d1d9 !important;
}

/* Logs no modo escuro */
body.dark-mode .logs-card {
    background: #161b22;
    border-color: #30363d;
}

body.dark-mode .logs-header {
    background: #0d1117;
    border-bottom-color: #30363d;
}

body.dark-mode .logs-header h3 {
    color: #c9d1d9;
}

/* Toggle switch no modo escuro */
body.dark-mode .toggle-text {
    color: #c9d1d9;
}

body.dark-mode .toggle-switch {
    background: #30363d;
}

/* Footer Styles */
.main-footer {
    background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
    color: white;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding: 0 2rem;
}

.footer-content p {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.3s ease, transform 0.2s ease;
    font-size: 0.9rem;
}

.footer-links a:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.footer-links svg {
    flex-shrink: 0;
}

/* Footer no modo escuro */
body.dark-mode .main-footer {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    border-top: 1px solid #30363d;
}

@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-content {
        padding: 0 1rem;
    }
}
