/* ==========================================================
   Insight Drive — paleta extraída da logomarca
   Navy profundo + gradiente azul/ciano + branco
   ========================================================== */

:root {
    --navy-900: #050f22;
    --navy-800: #081a35;
    --navy-700: #0b2245;
    --navy-600: #0f2c58;
    --blue-500: #0d6efd;
    --blue-600: #0057d9;
    --cyan-400: #22d3ee;
    --cyan-300: #5ce6ff;
    --cyan-glow: #00e5ff;
    --white: #ffffff;
    --gray-200: #dbe4f0;
    --gray-400: #9fb1cc;
    --gray-600: #6d7f9c;
    --danger: #ff5c6c;
    --success: #2ee6a6;
    --radius: 14px;
    --shadow-lg: 0 20px 45px rgba(0, 10, 30, 0.45);
    --shadow-sm: 0 6px 18px rgba(0, 10, 30, 0.3);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: radial-gradient(circle at 20% -10%, var(--navy-700) 0%, var(--navy-900) 55%, #020814 100%);
    color: var(--gray-200);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; }

/* ---------------- Layout de autenticação ---------------- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(160deg, rgba(15, 44, 88, 0.9), rgba(5, 15, 34, 0.95));
    border: 1px solid rgba(92, 230, 255, 0.15);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
    backdrop-filter: blur(6px);
}

.auth-logo {
    display: block;
    max-width: 260px;
    margin: 0 auto 28px;
}

.auth-card h1 {
    font-size: 20px;
    text-align: center;
    color: var(--white);
    margin: 0 0 6px;
    font-weight: 600;
}

.auth-card p.subtitle {
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    margin: 0 0 28px;
}

/* ---------------- Formulários ---------------- */

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--gray-400);
    margin-bottom: 6px;
    font-weight: 500;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(159, 177, 204, 0.25);
    border-radius: 10px;
    color: var(--white);
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
    outline: none;
    border-color: var(--cyan-400);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    width: 100%;
    background: linear-gradient(120deg, var(--blue-600), var(--cyan-400));
    color: #04121f;
    box-shadow: 0 10px 24px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover { box-shadow: 0 12px 28px rgba(34, 211, 238, 0.4); }

.btn-outline {
    background: transparent;
    border: 1px solid rgba(159, 177, 204, 0.35);
    color: var(--gray-200);
}

.btn-outline:hover { border-color: var(--cyan-400); color: var(--cyan-300); }

.btn-danger {
    background: rgba(255, 92, 108, 0.12);
    color: var(--danger);
    border: 1px solid rgba(255, 92, 108, 0.35);
}

.btn-danger:hover { background: rgba(255, 92, 108, 0.22); }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.error-box {
    background: rgba(255, 92, 108, 0.12);
    border: 1px solid rgba(255, 92, 108, 0.4);
    color: #ffb3ba;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
}

.success-box {
    background: rgba(46, 230, 166, 0.1);
    border: 1px solid rgba(46, 230, 166, 0.4);
    color: #9df5d6;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
}

.auth-footer-link {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: var(--gray-600);
}

/* ---------------- Top bar (área logada) ---------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: rgba(5, 15, 34, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(92, 230, 255, 0.12);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-brand img {
    height: 46px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.topbar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    padding-left: 12px;
    border-left: 1px solid rgba(159, 177, 204, 0.25);
}

.topbar-brand .brand-text span {
    color: var(--gray-400);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(159, 177, 204, 0.2);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    color: var(--gray-200);
}

.user-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cyan-glow);
    box-shadow: 0 0 8px var(--cyan-glow);
}

/* ---------------- Container geral ---------------- */

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    color: var(--white);
    font-size: 22px;
    margin: 0 0 4px;
}

.page-header p {
    color: var(--gray-400);
    font-size: 13px;
    margin: 0;
}

/* ---------------- Cards / grid ---------------- */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: linear-gradient(160deg, rgba(15, 44, 88, 0.7), rgba(5, 15, 34, 0.9));
    border: 1px solid rgba(92, 230, 255, 0.12);
    border-radius: var(--radius);
    padding: 18px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.panel {
    background: linear-gradient(160deg, rgba(15, 44, 88, 0.55), rgba(5, 15, 34, 0.85));
    border: 1px solid rgba(92, 230, 255, 0.12);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.panel h2 {
    color: var(--white);
    font-size: 16px;
    margin: 0 0 16px;
}

/* ---------------- Tabela de clientes ---------------- */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 640px;
}

.data-table th {
    text-align: left;
    color: var(--gray-400);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(159, 177, 204, 0.15);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(159, 177, 204, 0.08);
    color: var(--gray-200);
    vertical-align: middle;
}

.data-table tr:hover td { background: rgba(92, 230, 255, 0.04); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-active { background: rgba(46, 230, 166, 0.14); color: var(--success); }
.badge-inactive { background: rgba(255, 92, 108, 0.14); color: var(--danger); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Upload dropzone ---------------- */

.dropzone {
    border: 2px dashed rgba(92, 230, 255, 0.35);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    color: var(--gray-400);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: 22px;
}

.dropzone.dragover {
    border-color: var(--cyan-400);
    background: rgba(34, 211, 238, 0.06);
}

.dropzone svg { margin-bottom: 10px; color: var(--cyan-400); }

.dropzone strong { color: var(--white); }

.dropzone input[type="file"] { display: none; }

#uploadQueue { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

.upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
}

.upload-item .name { flex: 1; text-align: left; color: var(--gray-200); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.upload-item .progress-track {
    width: 90px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.upload-item .progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--blue-500), var(--cyan-400));
    transition: width .15s;
}

.upload-item .status-icon { width: 16px; text-align: center; }

/* ---------------- Grid de arquivos ---------------- */

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.file-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(159, 177, 204, 0.12);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .12s, border-color .12s;
}

.file-card:hover { transform: translateY(-2px); border-color: rgba(92, 230, 255, 0.35); }

.file-thumb {
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cyan-400);
}

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

.file-info {
    padding: 10px 10px 12px;
}

.file-name {
    font-size: 12.5px;
    color: var(--gray-200);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 11px;
    color: var(--gray-600);
    display: flex;
    justify-content: space-between;
}

.file-actions {
    display: flex;
    border-top: 1px solid rgba(159, 177, 204, 0.1);
}

.file-actions a, .file-actions button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--gray-400);
    padding: 9px 6px;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.file-actions a:hover { color: var(--cyan-300); background: rgba(92, 230, 255, 0.06); }
.file-actions button.delete-btn:hover { color: var(--danger); background: rgba(255, 92, 108, 0.08); }

.file-actions .divider { width: 1px; background: rgba(159, 177, 204, 0.1); }

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

.empty-state svg { color: var(--gray-600); margin-bottom: 12px; }

/* ---------------- Modal simples ---------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 20, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
    background: linear-gradient(160deg, rgba(15, 44, 88, 0.98), rgba(5, 15, 34, 0.98));
    border: 1px solid rgba(92, 230, 255, 0.2);
    border-radius: var(--radius);
    padding: 26px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.modal-box h3 { margin: 0 0 16px; color: var(--white); font-size: 17px; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.credentials-box {
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--gray-200);
    margin-top: 10px;
}

.credentials-box b { color: var(--white); }

/* ---------------- Responsivo ---------------- */

@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .topbar-brand img { height: 34px; max-width: 150px; }
    .topbar-brand .brand-text { display: none; }
    .page { padding: 20px 14px 50px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
    .panel { padding: 16px; }
    .auth-card { padding: 30px 22px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
.muted { color: var(--gray-400); }
.small { font-size: 12px; }
