/* ==========================================================================
   SEOC Data Entry Portal — Theme
   Extends /shared/apsdma-theme.css for SEOC-specific styles
   Light mode for data entry (DEOs work in office, not control room)
   ========================================================================== */

:root {
    --seoc-primary: #0c2340;
    --seoc-primary-light: #1a365d;
    --seoc-accent: #3182ce;
    --seoc-accent-hover: #2b6cb0;
    --seoc-success: #38a169;
    --seoc-danger: #e53e3e;
    --seoc-warning: #d69e2e;
    --seoc-info: #319795;
    --seoc-bg: #f0f4f8;
    --seoc-surface: #ffffff;
    --seoc-surface-alt: #f7fafc;
    --seoc-border: #e2e8f0;
    --seoc-text: #1a2332;
    --seoc-text-secondary: #4a5568;
    --seoc-text-muted: #a0aec0;
    --seoc-saffron: #FF9933;
    --seoc-green: #138808;
    --seoc-sidebar-w: 260px;
    --seoc-header-h: 56px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--seoc-bg);
    color: var(--seoc-text);
    overflow: hidden;
    height: 100vh;
}

/* ── Tricolor ── */
.tricolor { height: 4px; background: linear-gradient(90deg, var(--seoc-saffron) 33%, #fff 33% 66%, var(--seoc-green) 66%); flex-shrink: 0; }

/* ── Header ── */
.header {
    height: var(--seoc-header-h);
    background: linear-gradient(135deg, #0c2340, #1a365d);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 100;
}
.header-emblem { height: 36px; }
.header-title h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 800; letter-spacing: 0.3px; }
.header-title p { font-size: 11px; opacity: 0.7; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-user .user-name { font-weight: 600; font-size: 13px; }
.header-user .user-role { font-size: 11px; opacity: 0.7; }
.btn-logout {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.22); }
.btn-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
}

/* ── Layout ── */
.app-layout {
    display: flex;
    height: calc(100vh - var(--seoc-header-h) - 4px);
}

/* ── Sidebar ── */
.sidebar {
    width: var(--seoc-sidebar-w);
    background: var(--seoc-surface);
    border-right: 1px solid var(--seoc-border);
    overflow-y: auto;
    flex-shrink: 0;
    padding: 12px 0;
    z-index: 90;
}
.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--seoc-text-muted);
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--seoc-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.12s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: var(--seoc-surface-alt);
    color: var(--seoc-text);
}
.nav-item.active {
    background: #ebf8ff;
    color: var(--seoc-accent);
    border-left-color: var(--seoc-accent);
    font-weight: 600;
}
.nav-icon { font-size: 18px; width: 24px; text-align: center; }

/* Collapsible nav group (Deployment) */
.nav-group-toggle { cursor: pointer; }
.nav-chevron {
    margin-left: auto;
    font-size: 12px;
    color: var(--seoc-text-muted);
    transition: transform 0.15s;
}
.nav-group-items {
    background: #fafbfc;
    border-left: 2px solid var(--seoc-border);
    margin-left: 18px;
}
.nav-sub-item {
    padding-left: 20px !important;
    font-size: 12.5px;
    border-left: 3px solid transparent;
}
.nav-sub-item .nav-icon { font-size: 15px; }
.nav-badge {
    margin-left: auto;
    background: var(--seoc-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.nav-divider { height: 1px; background: var(--seoc-border); margin: 8px 16px; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: var(--seoc-bg);
}

/* ── Login ── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0c2340 0%, #1a365d 50%, #234e78 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.login-card .login-emblem { height: 56px; margin-bottom: 12px; }
.login-card h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; color: var(--seoc-primary); margin-bottom: 4px; }
.login-card .login-subtitle { font-size: 12px; color: var(--seoc-text-muted); margin-bottom: 24px; }
.login-card input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--seoc-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}
.login-card input:focus { outline: none; border-color: var(--seoc-accent); box-shadow: 0 0 0 3px rgba(49,130,206,0.15); }
.login-card .btn-login {
    width: 100%;
    padding: 12px;
    background: var(--seoc-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    margin-top: 4px;
}
.login-card .btn-login:hover { background: var(--seoc-accent-hover); }
.login-card .btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error { color: var(--seoc-danger); font-size: 12px; margin-top: 8px; min-height: 18px; }
.login-footer { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 24px; }

/* ── Page Title ── */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.page-header .page-icon { font-size: 32px; }
.page-header h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: var(--seoc-primary); }
.page-header p { font-size: 13px; color: var(--seoc-text-secondary); }

/* ── KPI Cards ── */
.kpi-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.kpi-card {
    background: var(--seoc-surface);
    border: 1px solid var(--seoc-border);
    border-radius: 10px;
    padding: 14px 18px;
    flex: 1;
    min-width: 140px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.15s;
}
.kpi-card:hover { transform: translateY(-1px); }
.kpi-value { font-size: 28px; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; color: var(--seoc-primary); }
.kpi-value.warning { color: var(--seoc-warning); }
.kpi-value.success { color: var(--seoc-success); }
.kpi-value.danger { color: var(--seoc-danger); }
.kpi-label { font-size: 11px; color: var(--seoc-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.kpi-icon { font-size: 20px; margin-bottom: 4px; }

/* ── Module Cards Grid ── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px; }
.module-card {
    background: var(--seoc-surface);
    border: 1px solid var(--seoc-border);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    position: relative;
}
.module-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.module-card .card-icon { font-size: 32px; margin-bottom: 8px; }
.module-card .card-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; font-weight: 700; color: var(--seoc-primary); margin-bottom: 3px; }
.module-card .card-desc { font-size: 11px; color: var(--seoc-text-muted); line-height: 1.4; margin-bottom: 12px; }
.module-card .card-stats { display: flex; gap: 16px; }
.module-card .card-stat-value { font-size: 22px; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; }
.module-card .card-stat-label { font-size: 10px; color: var(--seoc-text-muted); text-transform: uppercase; }
.module-card .card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--seoc-warning);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--seoc-border); margin-bottom: 16px; }
.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--seoc-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--seoc-text); }
.tab.active { color: var(--seoc-accent); border-bottom-color: var(--seoc-accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Toolbar ── */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.toolbar select, .toolbar input[type="date"] {
    padding: 7px 10px;
    border: 1px solid var(--seoc-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--seoc-surface);
}
.toolbar .btn {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: background 0.12s;
}
.btn-primary { background: var(--seoc-accent); color: #fff; }
.btn-primary:hover { background: var(--seoc-accent-hover); }
.btn-success { background: var(--seoc-success); color: #fff; }
.btn-success:hover { background: #2f855a; }
.btn-danger { background: var(--seoc-danger); color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-outline { background: var(--seoc-surface); color: var(--seoc-text); border: 1px solid var(--seoc-border); }
.btn-outline:hover { background: var(--seoc-surface-alt); }

/* ── Table Container ── */
.table-container {
    background: var(--seoc-surface);
    border: 1px solid var(--seoc-border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 300px;
}
.table-container .esri-feature-table { height: 400px; }

/* ── Native Form ── */
.survey-container {
    background: var(--seoc-surface);
    border: 1px solid var(--seoc-border);
    border-radius: 10px;
    padding: 24px;
}
.seoc-form { max-width: 800px; }
.form-section { margin-bottom: 24px; }
.form-section-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--seoc-primary);
    padding-bottom: 8px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--seoc-border);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.form-group { display: flex; flex-direction: column; }
.form-label { font-size: 12px; font-weight: 600; color: var(--seoc-text-secondary); margin-bottom: 4px; }
.form-input {
    padding: 9px 12px;
    border: 1px solid var(--seoc-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--seoc-accent); box-shadow: 0 0 0 3px rgba(49,130,206,0.12); }
.form-input:invalid:not(:placeholder-shown) { border-color: var(--seoc-danger); }
.form-textarea { resize: vertical; min-height: 60px; }
.form-hint { font-size: 11px; color: var(--seoc-text-muted); margin-top: 2px; }
/* ── Photo Upload ── */
.photo-upload-area { display: flex; flex-direction: column; }
.photo-preview { min-height: 10px; }

/* ── Aadhar Input ── */
input[name="aadhar_number"] { letter-spacing: 2px; font-family: 'Consolas', monospace; font-size: 16px; }

.form-import-bar {
    background: var(--seoc-surface-alt);
    border: 1px dashed var(--seoc-border);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}
.form-actions { display: flex; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--seoc-border); align-items: center; }
.btn-lg { padding: 12px 32px; font-size: 15px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Charts ── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card {
    background: var(--seoc-surface);
    border: 1px solid var(--seoc-border);
    border-radius: 10px;
    padding: 16px;
}
.chart-card h3 { font-size: 14px; font-weight: 700; color: var(--seoc-primary); margin-bottom: 12px; }
.chart-card canvas { max-height: 250px; }

/* ── Map ── */
.map-container {
    background: var(--seoc-surface);
    border: 1px solid var(--seoc-border);
    border-radius: 10px;
    overflow: hidden;
    height: 350px;
    margin-bottom: 20px;
}

/* ── Activity Feed ── */
.activity-feed { background: var(--seoc-surface); border: 1px solid var(--seoc-border); border-radius: 10px; padding: 16px; }
.activity-feed h3 { font-size: 14px; font-weight: 700; color: var(--seoc-primary); margin-bottom: 12px; }
.activity-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--seoc-border); font-size: 13px; }
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 18px; width: 28px; text-align: center; }
.activity-text { flex: 1; }
.activity-time { color: var(--seoc-text-muted); font-size: 11px; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--seoc-success);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 2000;
    animation: slideUp 0.3s ease;
}
.toast.error { background: var(--seoc-danger); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Loading ── */
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--seoc-border);
    border-top-color: var(--seoc-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Approval ── */
.approval-actions { display: flex; gap: 6px; }
.approval-actions .btn { padding: 4px 12px; font-size: 12px; }

/* ── Footer ── */
.app-footer {
    text-align: center;
    font-size: 11px;
    color: var(--seoc-text-muted);
    padding: 12px;
    border-top: 1px solid var(--seoc-border);
    background: var(--seoc-surface);
}

/* ── Record Detail Modal ── */
.record-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 16px;
    overflow-y: auto;
}
.record-modal {
    background: var(--seoc-surface);
    border-radius: 14px;
    width: 750px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalSlide 0.2s ease;
}
@keyframes modalSlide { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.record-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0c2340, #1a365d);
    color: #fff;
}
.record-modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.record-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 20px; }
.record-field { padding: 8px 0; border-bottom: 1px solid var(--seoc-border); }
.record-field-label { font-size: 11px; font-weight: 600; color: var(--seoc-text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.record-field-value { font-size: 14px; color: var(--seoc-text); word-break: break-word; }
.record-section-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700; color: var(--seoc-primary); margin-bottom: 10px; padding-top: 8px; border-top: 1px solid var(--seoc-border); }

/* ── Attachment Grid ── */
.attachment-grid { display: flex; flex-direction: column; gap: 10px; }
.attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--seoc-surface-alt);
    border: 1px solid var(--seoc-border);
    border-radius: 8px;
}
.attachment-preview {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--seoc-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.attachment-preview img { width: 100%; height: 100%; object-fit: cover; }
.attachment-icon { font-size: 28px; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { font-size: 11px; color: var(--seoc-text-muted); margin-top: 2px; }
.attachment-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Clickable table rows ── */
.table-container tr[onclick]:hover { background: #ebf8ff !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .btn-hamburger { display: block; }
    .sidebar {
        position: fixed;
        left: -280px;
        top: calc(var(--seoc-header-h) + 4px);
        bottom: 0;
        width: 280px;
        transition: left 0.25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 14px; }
    .kpi-bar { flex-direction: column; }
    .module-grid { grid-template-columns: 1fr; }
    .charts-row { grid-template-columns: 1fr; }
    .header-title p { display: none; }
}
