/* V COPC - Mobile First - Identidade Visual PMPE / Choque */
:root {
    --gold: #D4AF37;
    --gold-light: #F5D76E;
    --gold-dark: #B8860B;
    --black: #0a0a0a;
    --dark: #121212;
    --card: #1a1a1a;
    --card-hover: #222;
    --text: #f0f0f0;
    --text-muted: #aaa;
    --danger: #e74c3c;
    --success: #2ecc71;
    --warning: #f39c12;
    --border: #333;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--black);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    padding-bottom: 80px; /* space for bottom nav on mobile */
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

img { max-width: 100%; height: auto; }

/* Header */
.header {
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 2px solid var(--gold);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.header-logo {
    height: 42px;
    width: auto;
}

.header-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    flex: 1;
    line-height: 1.2;
}

.header-user {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--dark);
    border-top: 2px solid var(--gold);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 env(safe-area-inset-bottom);
    z-index: 100;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 6px 8px;
    min-width: 60px;
    transition: color 0.2s;
}

.bottom-nav a.active,
.bottom-nav a:hover {
    color: var(--gold);
}

.bottom-nav .icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--gold-light);
    margin-bottom: 4px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #000;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
    width: auto;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success { background: rgba(46,204,113,0.15); border: 1px solid var(--success); color: var(--success); }
.alert-danger { background: rgba(231,76,60,0.15); border: 1px solid var(--danger); color: var(--danger); }
.alert-warning { background: rgba(243,156,18,0.15); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background: rgba(212,175,55,0.15); border: 1px solid var(--gold); color: var(--gold-light); }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse at top, #1a1a1a 0%, #000 70%);
}

.login-logo {
    width: 160px;
    margin-bottom: 16px;
}

.login-banner {
    width: 100%;
    max-width: 360px;
    margin-bottom: 24px;
    border-radius: 8px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--card);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 0 40px rgba(212,175,55,0.15);
}

.login-box h1 {
    text-align: center;
    color: var(--gold);
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* Student List */
.aluno-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.aluno-item:hover {
    background: var(--card-hover);
}

.aluno-item.desligado {
    opacity: 0.55;
}

.aluno-item.desligado .aluno-nome {
    text-decoration: line-through;
    color: var(--text-muted);
}

.aluno-matricula {
    background: var(--gold);
    color: #000;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 36px;
    text-align: center;
}

.aluno-info {
    flex: 1;
}

.aluno-nome {
    font-weight: 600;
    font-size: 1rem;
}

.aluno-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-contador {
    background: rgba(46,204,113,0.2);
    color: var(--success);
}

.badge-desligado {
    background: rgba(231,76,60,0.2);
    color: var(--danger);
}

/* Caixa */
.caixa-resumo {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.caixa-card {
    background: var(--card);
    border-radius: 10px;
    padding: 14px 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.caixa-card .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.caixa-card .valor {
    font-size: 1.1rem;
    font-weight: 700;
}

.caixa-card.entrada .valor { color: var(--success); }
.caixa-card.saida .valor { color: var(--danger); }
.caixa-card.saldo .valor { color: var(--gold); }
.caixa-card.saldo {
    border-color: var(--gold);
    background: rgba(212,175,55,0.08);
}

.movimentacao {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.movimentacao:last-child { border-bottom: none; }

.mov-tipo {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.mov-tipo.entrada { background: rgba(46,204,113,0.2); color: var(--success); }
.mov-tipo.saida { background: rgba(231,76,60,0.2); color: var(--danger); }

.mov-valor.entrada { color: var(--success); font-weight: 700; }
.mov-valor.saida { color: var(--danger); font-weight: 700; }

.mov-info {
    flex: 1;
    padding: 0 10px;
}

.mov-desc { font-weight: 500; }
.mov-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Biblioteca */
.arquivo-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.arquivo-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.arquivo-icon {
    font-size: 1.6rem;
    color: var(--gold);
    text-align: center;
    line-height: 1;
}

.arquivo-info {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.arquivo-nome {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.arquivo-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.arquivo-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.arquivo-actions .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mobile: stack name above actions if needed is handled by grid minmax(0,1fr) */
@media (max-width: 767px) {
    .arquivo-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .arquivo-item {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        padding: 12px 10px;
    }
}

/* Admin */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.8rem;
}

.admin-table tr:hover {
    background: var(--card-hover);
}

/* Section title */
.section-title {
    font-size: 1.2rem;
    color: var(--gold);
    margin: 20px 0 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #333;
    transition: .3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--gold);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Empty state */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Desktop adjustments */
@media (min-width: 768px) {
    body { padding-bottom: 20px; }
    .bottom-nav { display: none; }
    .header-title { font-size: 1rem; }
    .caixa-resumo { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .caixa-card .valor { font-size: 1.4rem; }
    .arquivo-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .desktop-nav {
        display: flex;
        gap: 16px;
        margin-left: 20px;
    }
    .desktop-nav a {
        color: var(--text-muted);
        font-size: 0.9rem;
        font-weight: 500;
    }
    .desktop-nav a.active,
    .desktop-nav a:hover {
        color: var(--gold);
    }
}

@media (max-width: 767px) {
    .desktop-nav { display: none; }
}

/* Health section highlight */
.saude-section {
    border-left: 3px solid var(--danger);
    padding-left: 12px;
    margin-top: 16px;
}

.saude-section .card-title {
    color: #ff6b6b;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gold);
}


/* Tudo em caixa alta nos formulários */
.form-group input:not([type="password"]):not([type="date"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.form-group textarea,
.form-group select,
input[type="text"]:not([type="password"]),
textarea {
    text-transform: uppercase;
}
