/* ==========================================================
   styles.css — ajustes específicos do projeto CTE Informática
   Carregar SEMPRE depois de liquid-glass.css
   ========================================================== */

/* Navbar a ocupar toda a largura do topo, sem margens nem cantos arredondados */
.lg-nav {
    left: 0;
    right: 0;
    top: 0;
    transform: none;
    width: 100%;
    border-radius: 0;
}

/* ==========================================================
   Cores da escola: azul + amarelo
   Aplicadas nos dois temas, com texto/vidro ajustados para
   continuarem legíveis sobre um azul saturado.
   ========================================================== */

[data-theme="light"] {
    --bg-base: #00359e;

    /* orbs: mistura de azul e dourado, para dar movimento sem
       se tornarem ilegíveis sobre um fundo já saturado */
    --blob-1: rgba(10, 70, 190, 0.55);
    --blob-2: rgba(255, 204, 0, 0.30);
    --blob-3: rgba(40, 100, 210, 0.40);
    --blob-4: rgba(255, 224, 102, 0.22);

    /* painéis "vidro": como o fundo deixou de ser pálido,
       passam a translúcidos claros (como no tema escuro) */
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-bg-strong: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.28);
    --glass-hi: rgba(255, 255, 255, 0.40);
    --glass-inner: rgba(255, 255, 255, 0.08);
    --glass-sheen: 0.25;
    --glass-shadow: 0 10px 34px rgba(0, 10, 45, 0.35), 0 3px 10px rgba(0, 10, 45, 0.22);
    --glass-shadow-hover: 0 20px 54px rgba(0, 10, 45, 0.42), 0 6px 16px rgba(0, 10, 45, 0.26);

    /* texto claro, porque o fundo azul é escuro na prática */
    --text-1: rgba(255, 255, 255, 0.96);
    --text-2: rgba(255, 255, 255, 0.74);
    --text-3: rgba(255, 255, 255, 0.52);

    /* amarelo mais dourado (melhor contraste que o amarelo puro) */
    --accent: #ffcc00;
    --accent-2: #ffe066;
    --accent-deep: #d4a500;
    --accent-hover: #e6b800;
    --on-accent: #00359e; /* texto azul-escuro sobre botões amarelos: contraste forte */
}

[data-theme="dark"] {
    --bg-base: #101524;
    --blob-1: rgba(10, 70, 190, 0.40);
    --blob-2: rgba(255, 204, 0, 0.18);
    --blob-3: rgba(40, 100, 210, 0.28);
    --blob-4: rgba(255, 224, 102, 0.14);

    /* mesmo dourado no tema escuro, para a marca ficar consistente
       entre temas (o guia original mudava para verde aqui) */
    --accent: #ffcc00;
    --accent-2: #ffe066;
    --accent-deep: #d4a500;
    --accent-hover: #e6b800;
    --on-accent: #101524;
}

/* ==========================================================
   Página de autenticação (login.html)
   ========================================================== */
.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7rem 1rem 3rem;
}

.auth-container { width: 100%; max-width: 440px; }

.auth-card { padding: clamp(1.75rem, 5vw, 2.5rem); }

.auth-logo { text-align: center; margin-bottom: 0.4rem; }

.auth-subtitle {
    text-align: center;
    color: var(--text-2);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-tabs {
    display: flex; gap: 0.3rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    padding: 0.3rem;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1; padding: 0.6rem; border: none; background: transparent;
    border-radius: var(--radius-pill); color: var(--text-2);
    font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: all 0.2s var(--ease);
}

.auth-tab.active { background: var(--accent); color: #fff; }

.auth-form { display: none; flex-direction: column; gap: 1rem; }
.auth-form.active { display: flex; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }

.form-group input[type="email"],
.form-group input[type="text"],
.form-group input[type="password"] {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-1);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.password-input-wrapper { position: relative; }
.password-input-wrapper input { width: 100%; box-sizing: border-box; padding-right: 2.6rem; }
.toggle-password {
    position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-3);
    width: 22px; height: 22px; padding: 0;
}
.toggle-password svg { width: 20px; height: 20px; }

.password-strength { margin-top: 0.3rem; }
.strength-bar { height: 4px; border-radius: 2px; background: var(--glass-border); overflow: hidden; }
.strength-fill { height: 100%; width: 0%; transition: width 0.3s, background 0.3s; }
.strength-text { display: block; font-size: 0.75rem; color: var(--text-3); margin-top: 0.25rem; }

.auth-submit-btn {
    margin-top: 0.4rem; padding: 0.85rem; border: none;
    border-radius: var(--radius-pill); background: var(--accent); color: #fff;
    font-weight: 700; font-size: 0.95rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    transition: all 0.2s var(--ease);
}
.auth-submit-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.auth-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-loader .spinner { width: 20px; height: 20px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-message { margin-top: 1rem; text-align: center; font-size: 0.88rem; min-height: 1.2rem; }
.auth-message.success { color: #10b981; }
.auth-message.error { color: #ef4444; }

.email-confirmation-screen { text-align: center; padding: 1rem 0; }
.email-icon { position: relative; display: inline-block; margin-bottom: 1rem; color: var(--accent); }
.email-icon svg { width: 56px; height: 56px; }
.email-badge {
    position: absolute; bottom: -4px; right: -4px; background: var(--accent);
    color: #fff; border-radius: 50%; width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
}
.email-badge svg { width: 14px; height: 14px; }
.email-sent-to { color: var(--text-2); font-size: 0.9rem; margin: 0.4rem 0 0.1rem; }
.email-address { font-weight: 700; color: var(--text-1); margin-bottom: 1.2rem; }
.email-instructions { text-align: left; display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.2rem; }
.instruction-step { display: flex; align-items: center; gap: 0.7rem; font-size: 0.9rem; color: var(--text-2); }
.step-number {
    width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
    background: var(--glass-bg-strong); color: var(--text-1); font-size: 0.78rem;
    font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.email-note { font-size: 0.85rem; color: var(--text-3); margin-bottom: 0.4rem; }
.resend-email-btn, .back-to-login-btn {
    background: none; border: none; color: var(--accent); font-weight: 600;
    font-size: 0.88rem; cursor: pointer; padding: 0.3rem;
}
.email-divider { height: 1px; background: var(--glass-border); margin: 1rem 0; }

/* ==========================================================
   Área autenticada (dashboard.html, inventario.html, admin.html)
   ========================================================== */

.app-nav .user-menu {
    display: flex; align-items: center; gap: 0.8rem;
}

.user-info { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-name { font-weight: 600; font-size: 0.88rem; color: var(--text-1); }

.role-badge {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 0.1rem 0.5rem; border-radius: var(--radius-pill);
    background: var(--glass-bg-strong); color: var(--text-2); display: inline-block; width: fit-content;
}
.role-badge.role-admin { background: var(--accent); color: var(--on-accent); }
.role-badge.role-staff { background: var(--glass-hi); color: var(--text-1); }

.notification-menu { position: relative; }

.notification-toggle {
    position: relative;
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.14);
    color: var(--text-1); cursor: pointer; transition: all 0.2s var(--ease);
}
.notification-toggle:hover { color: var(--accent); background: rgba(255,255,255,0.22); }
.notification-toggle svg { width: 18px; height: 18px; }
.notification-count {
    position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px;
    padding: 0 3px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-pill); background: #ef4444; color: #fff;
    font-size: 0.65rem; font-weight: 700; line-height: 1;
}
.notification-count[hidden] { display: none; }
.notification-panel {
    position: absolute; z-index: 30; top: calc(100% + 0.65rem); right: 0;
    width: min(340px, calc(100vw - 2rem)); max-height: min(420px, 70vh);
    overflow-y: auto; padding: 1rem;
    background: color-mix(in srgb, var(--bg-base) 82%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
}
.notification-panel[hidden] { display: none; }
.notification-panel h2 { margin: 0 0 0.75rem; font-size: 1rem; }
.notification-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.notification-item {
    padding: 0.75rem; border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); background: var(--glass-bg);
}
.notification-item strong { color: var(--text-1); font-size: 0.88rem; }
.notification-item p { margin: 0.3rem 0; color: var(--text-2); font-size: 0.82rem; }
.notification-date, .notification-empty { color: var(--text-3); font-size: 0.78rem; }
.notification-empty { margin: 0; padding: 0.5rem 0; }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

.app-main { padding: 7rem 1rem 4rem; max-width: 1100px; margin: 0 auto; }

.page-head { margin-bottom: 2rem; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0.3rem 0 0.4rem; }
.page-sub { color: var(--text-2); }

.stats-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 2rem; }
.stat-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.4rem; }
.stat-label { font-size: 0.82rem; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--text-1); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }

.search-input {
    flex: 1; min-width: 220px; padding: 0.7rem 1rem;
    border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text-1); font-size: 0.9rem; font-family: inherit;
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.occurrence-card { padding: clamp(1rem, 3vw, 2rem); }
.occurrence-form { display: flex; flex-direction: column; gap: 1rem; }
.occurrence-form input,
.occurrence-form select,
.occurrence-form textarea {
    box-sizing: border-box; width: 100%; padding: 0.75rem 1rem;
    border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text-1); font-size: 0.95rem; font-family: inherit;
}
.occurrence-form input:focus,
.occurrence-form select:focus,
.occurrence-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.occurrence-form textarea { min-height: 10rem; resize: vertical; }
.occurrence-form input[readonly] { opacity: 0.8; }
.occurrence-help { color: var(--text-3); font-size: 0.82rem; margin: 0.15rem 0 0; }
.occurrence-form .auth-message { text-align: left; margin: 0; }
.occurrence-card { max-width: 760px; margin: 0 auto; }
.occurrence-detail-modal { max-width: 680px; }
.occurrence-detail-modal p { overflow-wrap: anywhere; }
.occurrence-detail-modal h4 { margin: 1.2rem 0 0.5rem; }
.occurrence-detail-modal ul { padding-left: 1.4rem; color: var(--text-2); }

/* ---------- Tabelas ---------- */
.table-wrap { padding: 0.4rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
thead th {
    text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--text-3); font-weight: 700; padding: 0.8rem 1rem; border-bottom: 1px solid var(--glass-border);
}
tbody td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--glass-border); font-size: 0.9rem; color: var(--text-1); }
tbody tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-3); padding: 2rem 1rem; }
.acoes-col { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.text-muted { color: var(--text-3); font-size: 0.85rem; }

/* ---------- Carrinho de requisição ---------- */
.cart-panel {
    position: fixed; bottom: 1.2rem; right: 1.2rem; width: min(360px, calc(100vw - 2.4rem));
    padding: 1.2rem; z-index: 50; max-height: 70vh; overflow-y: auto;
}
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; font-size: 0.95rem; }
.cart-header span { color: var(--text-2); font-size: 0.8rem; }
.cart-items { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.8rem; }
.cart-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.cart-item span { flex: 1; }
.cart-item input[type="number"] {
    width: 54px; padding: 0.3rem; border-radius: 6px; border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text-1); text-align: center;
}
.cart-remove { background: none; border: none; color: var(--text-3); font-size: 1.1rem; cursor: pointer; line-height: 1; }
.cart-dates { display: flex; gap: 0.6rem; margin-bottom: 0.8rem; }
.cart-dates label { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; color: var(--text-2); }
.cart-dates input[type="date"] {
    padding: 0.5rem; border-radius: 6px; border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text-1); font-family: inherit;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal { width: 100%; max-width: 420px; padding: 1.75rem; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 1.2rem; }
.modal .form-group { margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; }

@media (max-width: 640px) {
    .cart-panel { left: 1rem; right: 1rem; width: auto; }
}

/* ==========================================================
   Inventário em secções/tipos com cards (substitui a tabela)
   ========================================================== */

.inventario-container { display: flex; flex-direction: column; gap: 2.4rem; }

.material-section { display: flex; flex-direction: column; gap: 1.2rem; }
.section-title {
    font-size: 1.3rem; font-weight: 700; color: var(--text-1);
    padding-bottom: 0.5rem; border-bottom: 1px solid var(--glass-border);
}

.material-subgroup { display: flex; flex-direction: column; gap: 0.8rem; }
.subgroup-title {
    font-size: 0.95rem; font-weight: 600; color: var(--text-2);
    text-transform: uppercase; letter-spacing: 0.03em;
}

.materiais-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }

.material-card { padding: 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; }
.material-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.material-nome { font-weight: 700; color: var(--text-1); font-size: 1rem; }
.material-codigo {
    font-size: 0.72rem; font-weight: 700; color: var(--text-3);
    background: var(--glass-bg-strong); padding: 0.15rem 0.5rem; border-radius: var(--radius-pill);
    white-space: nowrap;
}
.material-descricao { font-size: 0.85rem; color: var(--text-2); margin: 0; }

.material-meta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 0.8rem;
    margin-top: 0.3rem; padding-top: 0.8rem; border-top: 1px solid var(--glass-border);
}
.material-meta div { display: flex; flex-direction: column; gap: 0.1rem; }
.material-meta span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-3); }
.material-meta strong { font-size: 0.88rem; color: var(--text-1); font-weight: 600; }

.material-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; flex-wrap: wrap; }

/* Formulário do modal com dois campos lado a lado (Secção/Tipo) */
.form-row { display: flex; gap: 0.8rem; }
.form-row .form-group { flex: 1; }

/* ==========================================================
   Página de utilizadores (admin.html)
   ========================================================== */
.text-ativo { color: #10b981; font-weight: 600; font-size: 0.85rem; }

.role-select {
    padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text-1); font-size: 0.85rem; font-family: inherit;
}
.role-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================
   Cartões de pré-visualização do inventário (clicáveis)
   ========================================================== */
.material-card {
    padding: 0; overflow: hidden; display: flex; flex-direction: column;
    text-decoration: none; color: inherit; cursor: pointer;
}
.material-card-img, .material-card-img-placeholder {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    background: var(--glass-bg-strong);
}
.material-card-img-placeholder {
    display: flex; align-items: center; justify-content: center;
}
.material-card-body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.material-card-body .material-nome { font-weight: 700; color: var(--text-1); font-size: 0.95rem; }
.material-card-body .material-codigo {
    font-size: 0.7rem; font-weight: 700; color: var(--text-3);
    background: var(--glass-bg-strong); padding: 0.1rem 0.45rem; border-radius: var(--radius-pill);
    width: fit-content;
}

.pill {
    font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill); width: fit-content;
}
.pill-ok { background: rgba(16, 185, 129, 0.18); color: #10b981; }
.pill-off { background: rgba(239, 68, 68, 0.18); color: #ef4444; }

/* ==========================================================
   Página de detalhe de um material (material.html)
   ========================================================== */
.container-narrow { max-width: 760px; margin: 0 auto; }

.back-link {
    display: inline-block; margin-bottom: 1.2rem; color: var(--text-2);
    font-size: 0.88rem; text-decoration: none; font-weight: 600;
}
.back-link:hover { color: var(--accent); }

.material-detail-card { display: flex; flex-direction: column; overflow: hidden; }
.material-detail-img { width: 100%; }
.material-img, .material-img-placeholder {
    width: 100%; max-height: 360px; object-fit: cover; display: block;
    background: var(--glass-bg-strong);
}
.material-img-placeholder {
    aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; color: var(--text-3);
}
.material-img-placeholder svg { width: 56px; height: 56px; }

.material-detail-info { padding: 1.6rem clamp(1.2rem, 4vw, 2rem) 2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.material-detail-info h1 { font-size: clamp(1.4rem, 3vw, 1.8rem); margin: 0.1rem 0 0.2rem; }
.material-detail-desc { color: var(--text-2); margin: 0.4rem 0; }

.material-meta-lg {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    margin-top: 1rem; padding-top: 1.2rem;
}
.material-meta-lg strong { font-size: 1.05rem; }

.material-detail-actions { display: flex; gap: 0.7rem; margin-top: 1.2rem; flex-wrap: wrap; }

/* ==========================================================
   Código de acesso (dashboard.html)
   ========================================================== */
.codigo-inline {
    font-family: 'Courier New', monospace; font-weight: 700; letter-spacing: 0.08em;
    background: var(--glass-bg-strong); padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.9rem;
}

.codigo-modal { text-align: center; }
.codigo-modal-sub { color: var(--text-2); font-size: 0.88rem; margin-bottom: 1.2rem; }
.codigo-grande {
    font-family: 'Courier New', monospace; font-weight: 700; font-size: 2.2rem; letter-spacing: 0.15em;
    background: var(--glass-bg-strong); border-radius: var(--radius-sm); padding: 0.8rem; margin-bottom: 1.2rem;
}
#codigo-qr { display: block; margin: 0 auto 1.2rem; border-radius: 10px; overflow: hidden; }
