/* ============================================================
   DuckSignal — Design System Principal (main.css)
   Dark theme com accent ciano elétrico e efeitos glassmorphism
   ============================================================ */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
    /* Cores principais */
    --bg-primary:     #0a0e1a;
    --bg-secondary:   #111827;
    --bg-card:        #111827;
    --bg-card-hover:  #1a2235;
    --bg-input:       #0d1321;
    --bg-sidebar:     #0f1525;
    
    /* Accent e status */
    --accent:         #00d4ff;
    --accent-glow:    rgba(0, 212, 255, 0.25);
    --accent-dim:     rgba(0, 212, 255, 0.1);
    --success:        #00ff88;
    --warning:        #ffaa00;
    --danger:         #ff4444;
    --info:           #6366f1;
    
    /* Texto */
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-accent:    #00d4ff;
    
    /* Bordas */
    --border-color:   rgba(255, 255, 255, 0.06);
    --border-accent:  rgba(0, 212, 255, 0.2);
    
    /* Sombras */
    --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg:      0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-accent:  0 0 20px rgba(0, 212, 255, 0.15);
    --shadow-glow:    0 0 40px rgba(0, 212, 255, 0.1);
    
    /* Tipografia */
    --font-primary:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display:   'Rajdhani', 'Inter', sans-serif;
    
    /* Espaçamento */
    --navbar-height:  60px;
    --sidebar-width:  300px;
    --border-radius:  12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Transições */
    --transition:     all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: #33ddff;
}

::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ---- Page Loader — Onda de rádio ---- */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.radio-wave-loader {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radio-wave-loader .wave {
    position: absolute;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: radio-wave 2s ease-out infinite;
}

.radio-wave-loader .wave:nth-child(1) { animation-delay: 0s; }
.radio-wave-loader .wave:nth-child(2) { animation-delay: 0.5s; }
.radio-wave-loader .wave:nth-child(3) { animation-delay: 1s; }
.radio-wave-loader .wave:nth-child(4) { animation-delay: 1.5s; }

@keyframes radio-wave {
    0% {
        width: 10px;
        height: 10px;
        opacity: 1;
    }
    100% {
        width: 80px;
        height: 80px;
        opacity: 0;
    }
}

.loader-text {
    margin-top: 60px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---- Navbar ---- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1000;
    transition: var(--transition);
}

.navbar-brand {
    flex-shrink: 0;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-img {
    width: 34px;
    height: 34px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo-accent {
    color: var(--accent);
}

/* Menu de navegação */
.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 2rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-dim);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Toggle hamburger */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.navbar-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Indicador de usuário */
.navbar-user {
    flex-shrink: 0;
    margin-left: auto;
}

.user-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.user-indicator:hover {
    border-color: var(--border-accent);
}

.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.user-callsign {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

/* ---- Main Content ---- */
.main-content {
    margin-top: var(--navbar-height);
    padding: 1.5rem;
    min-height: calc(100vh - var(--navbar-height) - 50px);
}

.main-content.full-height {
    padding: 0;
    height: calc(100vh - var(--navbar-height));
    overflow: hidden;
}

/* ---- Cards (glassmorphism) ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-accent);
    transform: translateY(-2px);
}

.card:hover::before {
    opacity: 1;
}

.card-glass {
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .icon {
    color: var(--accent);
}

/* ---- Stats Cards Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-accent);
    border-color: var(--border-accent);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
}

.stat-icon.accent  { background: var(--accent-dim); color: var(--accent); }
.stat-icon.success { background: rgba(0, 255, 136, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(255, 170, 0, 0.1); color: var(--warning); }
.stat-icon.info    { background: rgba(99, 102, 241, 0.1); color: var(--info); }

.stat-info {
    flex: 1;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Botões ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-accent {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-accent:hover {
    background: #33ddff;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent-dim);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #ff6666;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.3);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ---- Formulários ---- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2.5rem;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s ease forwards;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-info    { border-left: 3px solid var(--accent); }

.toast.removing {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ---- Footer ---- */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
}

.full-height ~ .footer {
    display: none;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-logo {
    width: 22px;
    height: 22px;
    opacity: 0.7;
}

.footer-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--success);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(0, 255, 136, 0); }
}

/* ---- Tabelas ---- */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--accent-dim);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 50px;
}

.badge-online  { background: rgba(0, 255, 136, 0.15); color: var(--success); }
.badge-offline { background: rgba(255, 68, 68, 0.15); color: var(--danger); }
.badge-unknown { background: rgba(255, 170, 0, 0.15); color: var(--warning); }
.badge-fm      { background: rgba(0, 212, 255, 0.15); color: var(--accent); }
.badge-dmr     { background: rgba(99, 102, 241, 0.15); color: var(--info); }
.badge-dstar   { background: rgba(0, 255, 136, 0.15); color: var(--success); }
.badge-fusion  { background: rgba(255, 170, 0, 0.15); color: var(--warning); }

/* ---- Seção de autenticação ---- */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--navbar-height) - 50px);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ---- Grids Responsivos ---- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* ---- Utilities ---- */
.text-accent  { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-center  { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ---- Responsivo ---- */
@media (max-width: 768px) {
    .navbar-toggle {
        display: flex;
    }
    
    .navbar-menu {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 14, 26, 0.97);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem 1.5rem;
        gap: 0.5rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .navbar-menu.open {
        transform: translateX(0);
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: var(--border-radius-sm);
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .auth-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
}
