/* ============================================
   SAAE Macaúbas - Design System v2.0
   Fonte: Outfit (Google Fonts)
   Paleta: Azul institucional / Water-inspired
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --blue-950: #061c33;
    --blue-900: #0a2540;
    --blue-800: #0d3b66;
    --blue-700: #1256a0;
    --blue-600: #1565C0;
    --blue-500: #1e88e5;
    --blue-400: #42a5f5;
    --blue-300: #4FC3F7;
    --blue-200: #81d4fa;
    --blue-100: #e3f2fd;
    --blue-50: #f0f7ff;
    --red: #c62828;
    --red-light: #ffebee;
    --orange: #ef6c00;
    --orange-light: #fff3e0;
    --green: #2e7d32;
    --green-light: #e8f5e9;
    --purple: #4527a0;
    --teal: #00838f;
    --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;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow: 0 1px 3px rgba(10,37,64,0.06), 0 6px 16px rgba(10,37,64,0.04);
    --shadow-md: 0 4px 12px rgba(10,37,64,0.08), 0 12px 32px rgba(10,37,64,0.05);
    --shadow-lg: 0 4px 12px rgba(10,37,64,0.08), 0 20px 48px rgba(10,37,64,0.06);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    line-height: 1.5;
}

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

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--blue-950) 0%, var(--blue-800) 40%, var(--blue-600) 100%);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(10,37,64,0.3);
}

.header-brand { display: flex; align-items: center; gap: 12px; color: white; }
.header-logo {
    width: 34px; height: 34px; background: rgba(255,255,255,0.12);
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.header-title { font-size: 15px; font-weight: 800; letter-spacing: 0.5px; color: white; }
.header-subtitle { font-size: 10px; opacity: 0.6; font-weight: 500; color: white; }

.header-nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
    color: rgba(255,255,255,0.7);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: flex; align-items: center; gap: 6px;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: white; text-decoration: none; }

.header-user {
    display: flex; align-items: center; gap: 10px; color: white;
    background: rgba(255,255,255,0.08); padding: 6px 14px 6px 10px;
    border-radius: 10px; font-size: 12px;
}
.header-avatar {
    width: 28px; height: 28px; background: var(--blue-400);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: var(--blue-900);
}
.header-user-name { font-weight: 600; }
.header-user-role { font-size: 10px; opacity: 0.6; }

/* ===== LAYOUT ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--blue-900); margin-bottom: 20px; }

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 18px 22px 14px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--gray-100);
}
.card-step {
    width: 28px; height: 28px; background: var(--blue-600); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--blue-900); }
.card-body { padding: 20px 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block; font-size: 12px; font-weight: 700;
    color: var(--gray-600); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 11px 14px; border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
    color: var(--gray-900); outline: none; transition: var(--transition);
    background: white;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(21,101,192,0.08);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-300); }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; font-weight: 600; }

/* ===== BUTTONS ===== */
.btn {
    padding: 11px 24px; border-radius: var(--radius-sm); border: none;
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    transition: var(--transition); text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
    color: white; box-shadow: 0 4px 14px rgba(21,101,192,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(21,101,192,0.4); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-outline { background: white; color: var(--blue-600); border: 2px solid var(--blue-600); }
.btn-outline:hover { background: var(--blue-50); }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--gray-50); font-weight: 700; color: var(--gray-600); text-transform: uppercase;
    letter-spacing: 0.5px; font-size: 11px; padding: 12px 16px; text-align: left; border-bottom: 2px solid var(--gray-200); }
td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
tr:hover td { background: var(--blue-50); }

/* ===== BADGES ===== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-rascunho { background: var(--orange-light); color: var(--orange); }
.badge-publicado { background: var(--green-light); color: var(--green); }
.badge-arquivado { background: var(--gray-100); color: var(--gray-500); }
.badge-admin { background: var(--red-light); color: var(--red); }
.badge-operador { background: var(--blue-100); color: var(--blue-700); }
.badge-visualizador { background: var(--gray-100); color: var(--gray-500); }
.badge-ativo { background: var(--green-light); color: var(--green); }
.badge-inativo { background: var(--red-light); color: var(--red); }

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }
.alert-error { background: var(--red-light); color: var(--red); border-left: 4px solid var(--red); }
.alert-info { background: var(--blue-100); color: var(--blue-700); border-left: 4px solid var(--blue-600); }
.alert-warning { background: var(--orange-light); color: var(--orange); border-left: 4px solid var(--orange); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10,37,64,0.5);
    backdrop-filter: blur(4px); z-index: 200;
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: white; border-radius: var(--radius-lg);
    width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(10,37,64,0.3);
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 800; color: var(--blue-900); }
.modal-close {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: var(--gray-100); cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--gray-200); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 14px 24px; border-radius: 12px; color: white;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 1000; transform: translateY(120%);
    transition: transform 0.3s ease; max-width: 400px;
}
.toast.show { transform: translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue-600); }

/* ===== SPINNER ===== */
.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--blue-950) 0%, var(--blue-800) 50%, var(--blue-600) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(79,195,247,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(66,165,245,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.login-pattern {
    position: absolute; inset: 0; opacity: 0.04;
    background:
        linear-gradient(60deg, white 25%, transparent 25.5%),
        linear-gradient(-60deg, white 25%, transparent 25.5%),
        linear-gradient(60deg, transparent 74.5%, white 75%),
        linear-gradient(-60deg, transparent 74.5%, white 75%);
    background-size: 48px 84px;
    pointer-events: none;
}

.login-container {
    width: 100%; max-width: 440px; margin: auto; padding: 40px 20px;
    position: relative; z-index: 1;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
    padding: 32px; text-align: center;
}

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

.login-brand { color: white; font-size: 22px; font-weight: 900; letter-spacing: 2px; }
.login-brand-sub { color: rgba(255,255,255,0.5); font-size: 11px; font-weight: 600; margin-top: 4px; letter-spacing: 1px; }

.login-body { padding: 32px; }
.login-footer { padding: 0 32px 28px; text-align: center; }
.login-footer a { font-size: 13px; font-weight: 600; }

.login-divider {
    text-align: center; color: var(--gray-400); font-size: 12px;
    margin: 20px 0; position: relative;
}
.login-divider::before, .login-divider::after {
    content: ''; position: absolute; top: 50%;
    width: calc(50% - 20px); height: 1px; background: var(--gray-200);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

/* ===== GRID ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* ===== STAT CARDS ===== */
.stat-card {
    padding: 20px; border-radius: var(--radius); background: white;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.stat-value { font-size: 26px; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 600; margin-top: 2px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--gray-100); padding: 4px; border-radius: var(--radius-sm); }
.tab {
    padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
    color: var(--gray-500); cursor: pointer; border: none; background: none;
    font-family: inherit; transition: var(--transition);
}
.tab:hover { color: var(--gray-700); }
.tab.active { background: white; color: var(--blue-700); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header { padding: 0 12px; }
    .header-nav { display: none; }
    .container { padding: 16px 12px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ===== MOBILE NAV ===== */
.mobile-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white; border-top: 1px solid var(--gray-200);
    padding: 8px 16px; z-index: 100;
    justify-content: space-around;
}
.mobile-nav a {
    display: flex; flex-direction: column; align-items: center;
    font-size: 10px; color: var(--gray-500); text-decoration: none; padding: 4px;
}
.mobile-nav a.active { color: var(--blue-600); }
.mobile-nav a span { font-size: 20px; margin-bottom: 2px; }

@media (max-width: 768px) {
    .mobile-nav { display: flex; }
    body { padding-bottom: 72px; }
}
