/* ============================================
   NEXA Display — Main Stylesheet
   Paleta: Royal Blue (#1a3c8f) + Neutros
   ============================================ */

:root {
    --royal-blue:       #1a3c8f;
    --royal-blue-dark:  #122b6b;
    --royal-blue-light: #2451b8;
    --royal-blue-soft:  #e8edf8;
    --royal-blue-mid:   #3b67d4;

    --accent:           #4f86f7;
    --accent-green:     #22c55e;
    --accent-amber:     #f59e0b;
    --accent-red:       #ef4444;

    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --white: #ffffff;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: 0.2s ease;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    line-height: 1.6;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--royal-blue-dark);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-icon {
    width: 40px; height: 40px;
    background: var(--royal-blue-mid);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.brand-company {
    font-size: 11px;
    color: rgba(255,255,255,.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    padding: 8px 10px 6px;
    margin-top: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-item i { font-size: 16px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: rgba(255,255,255,.14); color: white; }
.nav-item.active i { color: var(--accent); }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--royal-blue-mid);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-meta {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,.45);
}

.btn-logout {
    color: rgba(255,255,255,.4);
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}

.btn-logout:hover { color: var(--accent-red); background: rgba(239,68,68,.1); }

/* ── MAIN WRAPPER ────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

/* ── TOPBAR ──────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.sidebar-toggle:hover { background: var(--gray-100); }

.topbar-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-800);
    flex: 1;
}

.badge-plano {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--royal-blue-soft);
    color: var(--royal-blue);
    white-space: nowrap;
}

/* ── PAGE CONTENT ────────────────────────── */
.page-content {
    flex: 1;
    padding: 28px 28px 40px;
}

/* ── CARDS ───────────────────────────────── */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
    background: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5, .card-header h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    margin: 0;
    color: var(--gray-800);
}

.card-body { padding: 22px; }

/* ── STAT CARDS ──────────────────────────── */
.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: var(--royal-blue-soft); color: var(--royal-blue); }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.amber  { background: #fef3c7; color: #b45309; }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-icon.red    { background: #fee2e2; color: #b91c1c; }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1.1;
}
.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
    font-weight: 500;
}

/* ── BUTTONS ─────────────────────────────── */
.btn-primary {
    background: var(--royal-blue) !important;
    border-color: var(--royal-blue) !important;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--royal-blue-light) !important;
    border-color: var(--royal-blue-light) !important;
}

.btn-outline-primary {
    color: var(--royal-blue) !important;
    border-color: var(--royal-blue) !important;
}
.btn-outline-primary:hover {
    background: var(--royal-blue) !important;
    color: white !important;
}

/* ── FORMS ───────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: var(--royal-blue);
    box-shadow: 0 0 0 3px rgba(26,60,143,.12);
}

.form-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 6px;
}

/* ── TABLES ──────────────────────────────── */
.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    padding: 12px 16px;
}

.table td {
    padding: 14px 16px;
    vertical-align: middle;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.table tbody tr:hover { background: var(--gray-50); }

/* ── BADGES ──────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.badge-status.ativo   { background: #dcfce7; color: #15803d; }
.badge-status.inativo { background: #fee2e2; color: #b91c1c; }
.badge-status.suspenso{ background: #fef3c7; color: #92400e; }
.badge-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ── SCREEN CARDS ────────────────────────── */
.screen-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.screen-preview {
    background: var(--gray-900);
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.screen-preview-icon {
    font-size: 48px;
    color: rgba(255,255,255,.15);
}

.screen-preview.online::after {
    content: '';
    position: absolute;
    top: 10px; right: 10px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(34,197,94,.25);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0   rgba(34,197,94,.4); }
    70%  { box-shadow: 0 0 0 8px rgba(34,197,94,.0); }
    100% { box-shadow: 0 0 0 0   rgba(34,197,94,.0); }
}

.screen-info {
    padding: 16px;
}

.screen-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.screen-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.screen-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 8px;
}

/* ── SLIDE CARDS ─────────────────────────── */
.slide-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all var(--transition);
    cursor: grab;
}

.slide-card:hover { box-shadow: var(--shadow); }
.slide-card.dragging { opacity: .5; transform: scale(.98); }

.slide-thumb {
    height: 120px;
    background: linear-gradient(135deg, var(--royal-blue-dark), var(--royal-blue-mid));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: rgba(255,255,255,.4);
    position: relative;
    overflow: hidden;
}

.slide-thumb img { width: 100%; height: 100%; object-fit: cover; }

.slide-order-badge {
    position: absolute;
    top: 8px; left: 8px;
    width: 24px; height: 24px;
    background: rgba(0,0,0,.5);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-duration-badge {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0,0,0,.6);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
}

.slide-info { padding: 12px 14px; }
.slide-name { font-weight: 600; font-size: 13px; color: var(--gray-800); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-type { font-size: 11px; color: var(--gray-500); }

.slide-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 6px;
}

/* ── AUTH PAGES ──────────────────────────── */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--royal-blue-dark) 0%, var(--royal-blue) 50%, var(--royal-blue-mid) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-body::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(79,134,247,.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255,255,255,.05) 0%, transparent 40%);
}

.auth-card {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.auth-card-header {
    background: linear-gradient(135deg, var(--royal-blue-dark), var(--royal-blue));
    padding: 36px 40px 32px;
    text-align: center;
    color: white;
}

.auth-logo {
    width: 56px; height: 56px;
    background: rgba(255,255,255,.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}

.auth-card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.auth-card-subtitle {
    font-size: 13px;
    opacity: .7;
}

.auth-card-body { padding: 36px 40px; }

.auth-footer {
    text-align: center;
    padding: 0 40px 32px;
    font-size: 13px;
    color: var(--gray-500);
}

.auth-footer a { color: var(--royal-blue); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.password-hint {
    font-size: 11.5px;
    color: var(--gray-500);
    margin-top: 5px;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

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

.password-toggle:hover { color: var(--gray-700); }

/* ── PLAN CARDS ──────────────────────────── */
.plan-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 28px;
    text-align: center;
    position: relative;
    transition: all var(--transition);
    background: white;
    cursor: pointer;
}

.plan-card:hover { border-color: var(--royal-blue); box-shadow: var(--shadow); }
.plan-card.selected { border-color: var(--royal-blue); background: var(--royal-blue-soft); }
.plan-card.popular { border-color: var(--royal-blue); }

.plan-badge-popular {
    position: absolute;
    top: -12px; left: 50%;
    transform: translateX(-50%);
    background: var(--royal-blue);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.plan-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.plan-price {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--royal-blue);
}

.plan-price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--gray-500);
}

.plan-screens {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 8px;
}

.plan-screens strong { color: var(--royal-blue); }

/* ── MOBILE RESPONSIVE ───────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .sidebar-toggle { display: flex; }
    .main-wrapper { margin-left: 0; }
    .page-content { padding: 20px 16px; }
    .auth-card-body, .auth-card-header, .auth-footer { padding-left: 24px; padding-right: 24px; }
}

/* ── UTILITIES ───────────────────────────── */
.text-royal { color: var(--royal-blue); }
.bg-royal    { background: var(--royal-blue); }
.border-royal { border-color: var(--royal-blue) !important; }

.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.section-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 52px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

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

.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* Alert customizado */
.alert {
    border: none;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
}

.alert-success { background: #dcfce7; color: #15803d; }
.alert-danger   { background: #fee2e2; color: #b91c1c; }
.alert-warning  { background: #fef3c7; color: #92400e; }
.alert-info     { background: var(--royal-blue-soft); color: var(--royal-blue); }

/* Modal */
.modal-header {
    background: linear-gradient(135deg, var(--royal-blue-dark), var(--royal-blue));
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-title { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; }
.modal-header .btn-close { filter: invert(1); }
.modal-content { border: none; border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal-footer { border-top: 1px solid var(--gray-100); }
