/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f4f6f9;
    --bg-white: #ffffff;
    --border: #e2e6ec;
    --border-focus: #2e7d32;
    --text: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8888a0;
    --primary: #2e7d32;
    --primary-light: #4caf50;
    --primary-hover: #1b5e20;
    --primary-bg: rgba(46,125,50,0.08);
    --primary-glow: rgba(46,125,50,0.2);
    --accent: #1565c0;
    --danger: #d32f2f;
    --danger-hover: #b71c1c;
    --danger-bg: rgba(211,47,47,0.08);
    --gold: #8d6e2e;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
}
.container { max-width: 1000px; margin: 0 auto; padding: 0 2rem; }

/* ===== NAVBAR ===== */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
    overflow: visible;
}
.nav-container {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; justify-content: flex-end;
    padding: 0 2rem; height: 64px;
}
.nav-logo {
    display: flex; align-items: center; gap: 0.75rem;
    text-decoration: none; color: var(--text);
}
.nav-logo-img { width: 44px; height: 44px; border-radius: 50%; object-fit: contain; }
.nav-avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--bg-white);
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    margin-top: 16px;
    flex-shrink: 0;
    background: #e0d5c0;
}
.nav-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 20%;
}
.nav-logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem; font-weight: 700; color: var(--primary);
}
.nav-menu {
    display: flex; list-style: none; gap: 0.25rem; align-items: center;
}
.nav-link {
    text-decoration: none; color: var(--text-secondary);
    padding: 0.5rem 1rem; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500; transition: var(--transition);
}
.nav-link:hover { color: var(--primary); background: var(--primary-bg); }
.nav-link.active { color: var(--primary); font-weight: 700; }
.nav-link-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
    color: #fff !important; border-radius: var(--radius-sm); font-weight: 600 !important;
}
.nav-link-cta:hover { opacity: 0.9; }
.nav-link-cta.active { box-shadow: 0 2px 10px var(--primary-glow); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; flex-direction: column; gap: 5px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); transition: var(--transition); border-radius: 2px; }
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== HOME HERO ===== */
.hero-home { position: relative; min-height: 520px; display: flex; align-items: center; overflow: hidden; }
.hero-home-bg { position: absolute; inset: 0; }
.hero-home-img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.hero-home-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(0,0,0,0.55) 0%, rgba(46,125,50,0.3) 100%); }
.hero-home-content { position: relative; z-index: 2; max-width: 700px; padding: 3rem; color: #fff; }
.hero-home-overtitle { font-size: 0.85rem; letter-spacing: 3px; text-transform: uppercase; opacity: 0.85; margin-bottom: 0.5rem; }
.hero-home-title { font-family: 'Playfair Display', serif; font-size: 3.5rem; font-weight: 700; line-height: 1.1; margin-bottom: 0.75rem; }
.hero-home-subtitle { font-size: 1.1rem; opacity: 0.9; margin-bottom: 2rem; font-weight: 300; }
.hero-home-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ===== PAGE HERO (inner pages) ===== */
.page-hero { background: linear-gradient(135deg, var(--primary), var(--primary-light)); padding: 3rem 2rem; text-align: center; }
.page-hero-overtitle { font-size: 0.8rem; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,0.8); }
.page-hero-title { font-family: 'Playfair Display', serif; font-size: 2.5rem; font-weight: 700; color: #fff; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.8rem 1.5rem; border: none; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    transition: var(--transition); white-space: nowrap; font-family: inherit; text-decoration: none;
}
.btn-lg { padding: 1rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 4px 12px var(--primary-glow); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-hover), var(--primary)); transform: translateY(-1px); }
.btn-outline-white { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,0.6); }
.btn-outline-white:hover { background: rgba(255,255,255,0.15); border-color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: #f0f2f5; }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-outline:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-icon {
    padding: 0.5rem; border-radius: var(--radius-sm); background: transparent; border: none;
    cursor: pointer; color: var(--text-muted); transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--text); background: #f0f2f5; }
.btn-icon.edit:hover { color: var(--primary); background: var(--primary-bg); }
.btn-icon.delete:hover { color: var(--danger); background: var(--danger-bg); }

/* ===== FULLSCREEN MAP ===== */
.fullscreen-map {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dce3d3;
    min-height: calc(100vh - 64px - 100px);
}
.fullscreen-map-img {
    width: 70%;
    height: auto;
    display: block;
}

/* ===== HISTORY PAGE ===== */
.history-content { padding: 2.5rem 2rem 3rem; }
.history-page-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem; font-weight: 700; color: var(--primary);
    margin-bottom: 1.5rem; border-bottom: 2px solid var(--primary-bg); padding-bottom: 0.75rem;
}
.history-article { line-height: 1.8; }
.history-article p {
    color: var(--text-secondary); font-size: 0.95rem;
    margin-bottom: 1rem; text-align: justify;
}
.history-float-img {
    float: left; width: 280px; margin: 0.25rem 1.5rem 1rem 0;
    border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 64px - 100px); padding: 2rem;
}
.login-card {
    background: var(--bg-white); border: 1px solid var(--border); border-radius: 20px;
    padding: 3rem; text-align: center; max-width: 420px; width: 100%;
    box-shadow: var(--shadow-lg);
}
.login-seal { width: 100px; height: 100px; border-radius: 50%; object-fit: contain; margin-bottom: 1.5rem; }
.login-title { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.login-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.login-input-group { display: flex; gap: 0.5rem; }
.login-input-group input {
    flex: 1; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.9rem; font-family: inherit; color: var(--text);
}
.login-input-group input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }
.login-error { color: var(--danger); font-size: 0.8rem; margin-top: 0.75rem; min-height: 1.2em; }

/* ===== TITLE BAR (cadastro) ===== */
.title-bar {
    background: var(--bg-white); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; gap: 1.5rem;
    padding: 1.5rem 2rem; position: relative;
}
.title-bar::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(46,125,50,0.04) 0%, transparent 60%); pointer-events: none;
}
.badge-img {
    width: 100px; height: 100px; border-radius: 50%; object-fit: contain; flex-shrink: 0;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.1)); z-index: 1;
}
@keyframes badgeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.title-bar-text { z-index: 1; }
.page-overtitle { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; font-weight: 600; margin-bottom: 0.15rem; }
.page-title { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; line-height: 1.2; }
.page-subtitle { font-size: 0.85rem; color: var(--text-secondary); letter-spacing: 1px; margin-top: 0.25rem; font-weight: 500; }

/* ===== MAIN CONTAINER ===== */
.main-container { max-width: 1100px; margin: 0 auto; padding: 2rem; }

/* ===== ACTION BAR ===== */
.action-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.search-box { flex: 1; min-width: 260px; position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search-box input {
    width: 100%; padding: 0.8rem 1rem 0.8rem 2.8rem; background: var(--bg-white);
    border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
    font-size: 0.9rem; transition: var(--transition); box-shadow: var(--shadow-sm);
}
.search-box input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-box input::placeholder { color: var(--text-muted); }

/* ===== STATS ===== */
.stats-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; display: flex; flex-direction: column; align-items: center;
    box-shadow: var(--shadow-sm); transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-number { font-size: 2.2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 0.25rem; font-weight: 600; }

/* ===== TABLE ===== */
.table-container { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-header-row { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 0.5rem; }
.table-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.table-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--primary-bg); }
th { padding: 0.875rem 1.25rem; text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--primary); font-weight: 700; white-space: nowrap; }
.th-actions { text-align: center; width: 100px; }
td { padding: 1rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
tr { transition: var(--transition); }
tbody tr:hover { background: #f8faf8; }
.td-name { font-weight: 600; color: var(--text); }
.td-location { color: var(--text-secondary); font-size: 0.85rem; }
.td-phone { color: var(--text-secondary); font-weight: 500; font-size: 0.85rem; }
.td-date { color: var(--text-muted); font-size: 0.85rem; }
.td-actions { display: flex; gap: 0.25rem; justify-content: center; }

/* ===== EMPTY STATE ===== */
.empty-state { display: none; text-align: center; padding: 3rem 2rem; }
.empty-state.visible { display: block; }
.empty-seal { width: 90px; height: 90px; border-radius: 50%; opacity: 0.4; margin-bottom: 1rem; }
.empty-text { font-size: 1.05rem; color: var(--text-secondary); font-weight: 500; }
.empty-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-white); border: 1px solid var(--border); border-radius: 16px;
    width: 90%; max-width: 600px; box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95); transition: transform 0.3s ease; max-height: 90vh; overflow-y: auto;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 420px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--primary-bg), transparent); }
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.modal-close { width: 32px; height: 32px; border: none; background: transparent; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; border-radius: 50%; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #f0f2f5; color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1.25rem 1.5rem; border-top: 1px solid var(--border); background: #f8f9fb; }

/* ===== FORM ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.required { color: var(--danger); }
.form-group input, .form-group select {
    padding: 0.7rem 0.9rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.9rem; font-family: inherit; transition: var(--transition);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); background: var(--bg-white); }
.form-group input::placeholder { color: var(--text-muted); opacity: 0.7; }
.form-group select { cursor: pointer; }

/* ===== DELETE MODAL ===== */
.delete-body { padding: 2rem; text-align: center; }
.delete-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.delete-name { font-weight: 700; color: var(--text); font-size: 1.1rem; margin: 0.5rem 0; }
.delete-warn { font-size: 0.8rem; color: var(--danger); margin-top: 0.75rem; opacity: 0.8; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
    padding: 0.875rem 1.25rem; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500;
    color: #fff; box-shadow: var(--shadow); display: flex; align-items: center; gap: 0.75rem;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards; min-width: 280px;
}
.toast.success { background: linear-gradient(135deg, #1b5e20, #2e7d32); }
.toast.error { background: linear-gradient(135deg, #b71c1c, #d32f2f); }
.toast.info { background: linear-gradient(135deg, #1565c0, #1976d2); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { transform: translateX(100%); opacity: 0; } }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 2rem; background: var(--bg-white); border-top: 1px solid var(--border); }
.footer-main { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.footer-dev { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.footer-dev a { color: var(--primary); text-decoration: none; font-weight: 600; transition: var(--transition); }
.footer-dev a:hover { color: var(--primary-hover); text-decoration: underline; }
.credit-dev { text-align: right; font-size: 0.7rem; color: var(--text-muted); margin-top: 1rem; padding: 0.5rem 0; }
.credit-dev a { color: var(--primary); text-decoration: none; font-weight: 600; transition: var(--transition); }
.credit-dev a:hover { color: var(--primary-hover); text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav-menu { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-white); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
    .nav-menu.open { display: flex; }
    .nav-toggle { display: flex; }
    .hero-home { min-height: 400px; }
    .hero-home-title { font-size: 2.2rem; }
    .hero-home-content { padding: 2rem; }
    .hero-home-actions { flex-direction: column; }
    .cards-grid { grid-template-columns: 1fr; }
    .title-bar { flex-direction: row; padding: 1rem; gap: 1rem; }
    .badge-img { width: 70px; height: 70px; }
    .page-title { font-size: 1.3rem; }
    .main-container { padding: 1.5rem 1rem; }
    .stats-bar { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; }
    .search-box { min-width: 100%; }
    th, td { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
    .page-hero-title { font-size: 1.8rem; }
    .table-header-row { flex-direction: column; align-items: flex-start; }
}
