/* ============================================================
   Sinpesca — Design System v3 "Oceano Digital"
   Cores dinâmicas via PHP + banco de dados
   NÃO editar manualmente — usar painel de manutenção
============================================================ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
    --primary:          #1BCDA5;
    --primary-hover:    #05b78f;
    --primary-soft:     rgba(27,205,165,0.15);
    --primary-border:   rgba(27,205,165,0.32);
    --primary-glow:     rgba(27,205,165,0.28);

    --bg-main:          #0F172A;
    --bg-card:          #1E293B;
    --bg-sidebar:       #0B1120;

    --text-main:        #E2E8F0;
    --text-muted:       #8899b4;
    --text-light:       #4e6080;

    --sidebar-text:     #f1f5f9;
    --sidebar-muted:    #8899b4;
    --sidebar-hover:    rgba(255,255,255,0.06);
    --sidebar-active:   rgba(255,255,255,0.10);

    --success:          #34d399;
    --success-bg:       rgba(16,185,129,0.12);
    --success-border:   rgba(52,211,153,0.22);
    --success-text:     #34d399;
    --warning:          #fbbf24;
    --warning-bg:       rgba(245,158,11,0.12);
    --warning-border:   rgba(251,191,36,0.22);
    --warning-text:     #fbbf24;
    --danger:           #f87171;
    --danger-bg:        rgba(239,68,68,0.12);
    --danger-border:    rgba(248,113,113,0.22);
    --danger-text:      #f87171;
    --info:             #5EA7D3;

    --border-color:     rgba(255,255,255,0.07);
    --input-border:     rgba(255,255,255,0.11);
    --input-bg:         rgba(0,0,0,0.22);
    --th-bg:            rgba(0,0,0,0.28);
    --tr-hover:         rgba(255,255,255,0.03);

    --glass-bg:         rgba(30,41,59,0.55);
    --glass-border:     rgba(255,255,255,0.06);
    --glass-blur:       blur(16px);

    --shadow-xs:    0 1px 2px rgba(0,0,0,0.35);
    --shadow-sm:    0 2px 6px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:    0 6px 20px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);
    --shadow-lg:    0 12px 36px rgba(0,0,0,0.55), 0 4px 10px rgba(0,0,0,0.35);
    --shadow-xl:    0 24px 48px rgba(0,0,0,0.65), 0 10px 16px rgba(0,0,0,0.4);

    --radius-sm:    6px;
    --radius:       10px;
    --radius-lg:    14px;
    --radius-xl:    20px;
    --radius-full:  9999px;

    --transition:   0.18s cubic-bezier(0.4,0,0.2,1);
    --container-max:1280px;

    --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Montserrat', var(--font-body);
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }

/* ── BASE ────────────────────────────────────────────────────── */
body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    letter-spacing: -0.02em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ──────────────────────────────────────────────────── */
.container { width:100%; max-width:var(--container-max); margin:0 auto; padding:0 1.5rem; }

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.dashboard-header h1 { font-size: 1.65rem; }
.dashboard-header p  { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.2rem; font-family: var(--font-body); font-weight: 400; letter-spacing: 0; }

/* ── CARD ────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }

/* Linha colorida no topo */
.card-accent { border-top: 2.5px solid var(--primary); }

/* Glass variant */
.card-glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }

label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 0.68rem 0.9rem;
    font-size: 0.9rem;
    font-family: var(--font-body);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    background-color: var(--input-bg);
    color: var(--text-main);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}
/* Fix select option background for dark mode */
select option { background-color: #1E293B; color: #E2E8F0; }

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background-color: var(--input-bg);
}

input::placeholder, textarea::placeholder { color: var(--text-light); }
textarea { resize: vertical; line-height: 1.5; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.125rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-body);
    border-radius: var(--radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: #0f172a;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 6px 20px var(--primary-glow);
    transform: translateY(-1px);
    text-decoration: none;
    color: #0f172a;
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}
.btn-outline:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}
.btn-danger:hover {
    background: var(--danger-border);
    text-decoration: none;
    color: var(--danger-text);
    border-color: var(--danger);
}

.btn-sm { padding: 0.35rem 0.72rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.5rem;  font-size: 0.975rem; }
.w-full  { width: 100%; }

/* ── TABLE ───────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

table { width: 100%; border-collapse: collapse; }
thead { position: sticky; top: 0; z-index: 1; }

th {
    background: var(--th-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1.5px solid var(--border-color);
    white-space: nowrap;
    font-family: var(--font-body);
}

td {
    padding: 0.9rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--tr-hover); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-success { background: var(--success-bg);  color: #34d399; border: 1px solid var(--success-border); }
.badge-danger  { background: var(--danger-bg);   color: #f87171;  border: 1px solid var(--danger-border); }
.badge-warning { background: var(--warning-bg);  color: #fbbf24; border: 1px solid var(--warning-border); }
.badge-primary { background: var(--primary-soft); color: var(--primary);              border: 1px solid var(--primary-border); }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    line-height: 1.5;
    border-width: 1.5px;
    border-style: solid;
}
.alert-error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger-text); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    padding: 1.75rem 1.25rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--glass-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--sidebar-text);
    margin-bottom: 2.25rem;
    padding: 0 0.5rem;
    letter-spacing: 0.02em;
}

.sidebar-logo-icon {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #0f172a;
    font-size: 0.95rem; font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.sidebar-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-muted);
    padding: 0 0.75rem;
    margin: 1.25rem 0 0.5rem;
}

.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-muted);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    text-decoration: none;
}
.sidebar-nav a.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
    border: 1px solid var(--primary-border);
}
.sidebar-nav li { position: relative; }
.sidebar-spacer { flex: 1; }

.main-content { margin-left: 260px; padding: 2rem; min-height: 100vh; }

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0.8;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--primary-soft);
    border: 1px solid var(--primary-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-info .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-main);
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 0.2rem;
}
.stat-info .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── GRID / UTILS ────────────────────────────────────────────── */
.grid { display: grid; gap: 1.5rem; }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px)  {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.flex             { display: flex; }
.flex-col         { flex-direction: column; }
.flex-wrap        { flex-wrap: wrap; }
.items-center     { align-items: center; }
.items-end        { align-items: flex-end; }
.items-start      { align-items: flex-start; }
.justify-between  { justify-content: space-between; }
.justify-center   { justify-content: center; }
.justify-end      { justify-content: flex-end; }
.gap-1 { gap: 0.375rem; }
.gap-2 { gap: 0.625rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-light   { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.72rem; }
.font-mono    { font-family: 'Fira Code', 'Cascadia Code', monospace; }

.mt-1{margin-top:.375rem;}.mt-2{margin-top:.625rem;}.mt-3{margin-top:1rem;}.mt-4{margin-top:1.5rem;}
.mb-1{margin-bottom:.375rem;}.mb-2{margin-bottom:.625rem;}.mb-3{margin-bottom:1rem;}.mb-4{margin-bottom:1.5rem;}
.p-0{padding:0;}
.hidden { display: none; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── DIVIDER ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-color); margin: 1.5rem 0; }

.divider-text {
    display: flex; align-items: center; gap: 0.75rem;
    color: var(--text-muted); font-size: 0.78rem; margin: 1.25rem 0;
}
.divider-text::before, .divider-text::after {
    content: ''; flex: 1; height: 1px; background: var(--border-color);
}

/* ── RESPONSIVE (base — overridden in painel.php) ────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: 100%; height: auto; position: relative;
        flex-direction: row; flex-wrap: wrap; padding: 1rem; gap: 0.5rem;
    }
    .sidebar-logo { margin-bottom: 0; flex: 1; }
    .sidebar-section-label { display: none; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; width: 100%; gap: 4px; }
    .sidebar-nav a { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
    .sidebar-spacer { display: none; }
    .main-content { margin-left: 0; padding: 1rem; }
    .dashboard-header { flex-direction: column; }
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── SELECTION ───────────────────────────────────────────────── */
::selection { background: var(--primary-soft); color: var(--primary); }
