/* ===== GLOBAL RESET & VARIABLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #732269;
  --primary-dark: #5a1b52;
  --primary-light: #9b3d8e;
  --bg: #f4f6f9;
  --white: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
}
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; }
.login-container { display: flex; width: 100%; min-height: 100vh; }
.login-left { flex: 1; background: linear-gradient(135deg, #732269 0%, #4a1544 50%, #2d0d28 100%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-left::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%); animation: pulse 8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.login-hero { text-align: center; z-index: 1; padding: 40px; }
.hero-overlay h1 { color: white; font-size: 2.5rem; line-height: 1.3; margin-bottom: 15px; }
.hero-overlay p { color: rgba(255,255,255,0.8); font-size: 1.2rem; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--white); }
.login-form-container { width: 100%; max-width: 420px; padding: 40px; }
.login-logo { text-align: center; margin-bottom: 30px; }
.logo-img { height: 60px; }
.login-form-container h2 { text-align: center; color: var(--primary); margin-bottom: 5px; font-size: 1.3rem; }
.login-subtitle { text-align: center; color: var(--text-light); margin-bottom: 25px; }
.login-error { background: #fee; border: 1px solid #e74c3c; color: #e74c3c; padding: 10px 15px; border-radius: var(--radius); margin-bottom: 15px; font-size: 13px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text); font-size: 13px; }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon i:first-child { position: absolute; left: 12px; color: var(--text-light); z-index: 1; }
.input-with-icon input { padding-left: 38px; }
.toggle-password { position: absolute; right: 10px; background: none; border: none; cursor: pointer; color: var(--text-light); }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; transition: border-color 0.2s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(115,34,105,0.1); }
textarea { resize: vertical; min-height: 80px; }
.btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #f8f0f7; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-login { width: 100%; justify-content: center; padding: 12px; font-size: 16px; margin-bottom: 15px; }
.forgot-password { display: block; text-align: center; color: var(--primary); font-size: 13px; }
.login-footer { text-align: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-light); font-size: 12px; }

/* ===== APP LAYOUT ===== */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 0 24px; height: 64px; background: var(--white); border-bottom: 2px solid var(--primary); box-shadow: var(--shadow); z-index: 100; }
.header-left { display: flex; align-items: center; gap: 15px; }
.header-logo { height: 40px; }
.header-title h1 { font-size: 1.1rem; color: var(--primary); }
.header-right { position: relative; }
.header-user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 12px; border-radius: var(--radius); transition: background 0.2s; }
.header-user:hover { background: #f8f0f7; }
.user-avatar { font-size: 28px; color: var(--primary); }
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-light); }
.user-menu { position: absolute; top: 100%; right: 0; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 180px; z-index: 200; }
.user-menu a { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text); font-size: 13px; transition: background 0.2s; text-decoration: none; }
.user-menu a:hover { background: #f8f0f7; color: var(--primary); }

/* ===== NAVIGATION ===== */
.app-nav { background: var(--primary); padding: 0 24px; }
.nav-menu { display: flex; list-style: none; gap: 0; }
.nav-item { color: rgba(255,255,255,0.85); padding: 14px 20px; cursor: pointer; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; position: relative; transition: all 0.2s; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.15); color: white; }
.nav-item.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: white; }
.sub-arrow { font-size: 10px; margin-left: 4px; }
.has-submenu { position: relative; }
.submenu { display: none; position: absolute; top: 100%; left: 0; background: var(--white); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 220px; z-index: 150; list-style: none; }
.has-submenu:hover .submenu { display: block; }
.submenu li { padding: 10px 16px; color: var(--text); font-size: 13px; cursor: pointer; transition: background 0.2s; }
.submenu li:hover { background: #f8f0f7; color: var(--primary); }

/* ===== MAIN CONTENT ===== */
.app-main { flex: 1; padding: 20px 24px; }
.page { display: none; }
.page.active { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.breadcrumb { color: var(--text-light); font-size: 13px; }
.breadcrumb i { margin-right: 5px; }

/* ===== FILTER PANEL ===== */
.filter-panel { display: flex; align-items: flex-end; gap: 12px; padding: 12px 20px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; flex-wrap: nowrap; overflow-x: auto; }
.filter-group { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-light); white-space: nowrap; }
.filter-group input, .filter-group select { min-width: 130px; padding: 7px 10px; font-size: 13px; }
.filter-group span { align-self: center; color: var(--text-light); font-size: 12px; }
.filter-group.filter-duration { display: flex; flex-direction: column; gap: 4px; }
.filter-group.filter-duration .duration-inputs { display: flex; align-items: center; gap: 6px; }
.filter-group.filter-duration .duration-inputs input { min-width: 130px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 20px; }
.kpi-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 15px; border-left: 4px solid; transition: transform 0.2s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.kpi-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; flex-shrink: 0; }
.kpi-content h3 { font-size: 1.6rem; color: var(--text); }
.kpi-content p { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ===== CHARTS ===== */
.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.chart-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.chart-card h3 { font-size: 15px; color: var(--primary); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.chart-card canvas { max-height: 280px; }

/* ===== DATA TABLES ===== */
.table-container { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8f0f7; color: var(--primary); padding: 12px 15px; text-align: left; font-size: 13px; font-weight: 600; border-bottom: 2px solid var(--primary); white-space: nowrap; }
.data-table td { padding: 10px 15px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tbody tr:hover { background: #faf5f9; }
.data-table.full-width { width: 100%; }
.table-input { width: 100%; padding: 6px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; }
.table-footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; background: var(--white); border-radius: 0 0 var(--radius) var(--radius); border-top: 1px solid var(--border); font-size: 13px; color: var(--text-light); }
.items-per-page select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 8px; }
.pagination span { padding: 4px 8px; cursor: pointer; }

/* ===== BADGES ===== */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active { background: #e6f9ee; color: #27ae60; }
.badge-walkout { background: #fde8e8; color: #e74c3c; }
.badge-approved { background: #e6f0ff; color: #3498db; }

/* ===== BUTTONS ===== */
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px 8px; color: var(--primary); font-size: 14px; border-radius: 4px; transition: background 0.2s; }
.btn-icon:hover { background: #f8f0f7; }
.text-danger { color: #e74c3c !important; }
.fab { display: inline-flex; }

/* ===== TAB CONTAINER ===== */
.tab-container { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.tab-nav { display: flex; border-bottom: 2px solid var(--border); overflow-x: auto; }
.tab-btn { padding: 14px 20px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-light); position: relative; white-space: nowrap; transition: color 0.2s; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 3px; background: var(--primary); }
.tab-content { display: none; padding: 25px; }
.tab-content.active { display: block; }

/* ===== FORM GRID ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 25px; }

/* ===== VIEW PROFILE ===== */
.view-profile { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 25px; }
.profile-header { display: flex; align-items: center; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.profile-photo { width: 90px; height: 90px; border-radius: 50%; background: #f8f0f7; display: flex; align-items: center; justify-content: center; }
.profile-summary h2 { color: var(--primary); margin-bottom: 5px; }
.profile-summary p { color: var(--text-light); font-size: 13px; }
.view-section { margin-bottom: 25px; }
.view-section h3 { color: var(--primary); font-size: 15px; margin-bottom: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-item label { font-size: 11px; color: var(--text-light); font-weight: 600; text-transform: uppercase; }
.detail-item span { font-size: 14px; color: var(--text); }

/* ===== UPLOAD SECTION ===== */
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px; text-align: center; background: #faf5f9; }
.upload-icon { font-size: 40px; color: var(--primary); margin-bottom: 10px; }
.upload-area p { margin-bottom: 5px; }
.upload-area small { color: var(--text-light); }

/* ===== PER CAPITA DISPLAY ===== */
.per-capita-display { margin-top: 15px; padding: 12px 15px; background: #f8f0f7; border-radius: var(--radius); font-size: 14px; }

/* ===== INFO BANNER ===== */
.info-banner { display: flex; gap: 30px; padding: 15px 20px; background: #f8f0f7; border-radius: var(--radius); margin-bottom: 20px; flex-wrap: wrap; }
.info-item { font-size: 14px; }

/* ===== STAGE SELECT ===== */
.stage-select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; font-weight: 600; }

/* ===== INDIA MAP (Leaflet) ===== */
.map-section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.map-section h3 { color: var(--primary); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
#leafletMap { width: 100%; height: 500px; border-radius: var(--radius); border: 1px solid var(--border); }

/* ===== FLP PHOTO ===== */
.photo-upload-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.photo-preview { width: 120px; height: 150px; border-radius: var(--radius); border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; background: #faf5f9; cursor: pointer; transition: border-color 0.2s; }
.photo-preview:hover { border-color: var(--primary); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview i { font-size: 36px; color: var(--text-light); }
.photo-preview-label { font-size: 11px; color: var(--text-light); text-align: center; }
.profile-photo-img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); }

/* ===== MODAL ===== */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 300; }
.modal-content { background: var(--white); border-radius: var(--radius); width: 100%; max-width: 450px; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { color: var(--primary); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 20px; border-top: 1px solid var(--border); }

/* ===== CAPABILITY LIST (role/user view) ===== */
.capability-list { list-style: none; padding: 0; margin: 0; }
.capability-list li { padding: 6px 0; font-size: 13px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #f0f0f0; }
.capability-list li:last-child { border-bottom: none; }

/* ===== SURVEY VIEW ===== */
.survey-view { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 25px; }

/* ===== ASSESSMENT FORM ===== */
.assessment-question { background: var(--bg); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; border-left: 3px solid var(--primary); }
.assessment-question > label { display: block; font-weight: 600; color: var(--text-dark); font-size: 13px; margin-bottom: 10px; line-height: 1.5; }
.radio-group, .checkbox-group { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.radio-label { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; padding: 4px 0; line-height: 1.4; }
.radio-label input[type="radio"], .radio-label input[type="checkbox"] { margin-top: 2px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.assessment-question input[type="text"] { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ===== EMPLOYMENT CONDITIONAL ===== */
.employment-conditional { grid-column: 1 / -1; }

/* ===== PROGRESS BAR ===== */
.progress-bar { height: 8px; background: #eee; border-radius: 4px; overflow: hidden; width: 100px; display: inline-block; vertical-align: middle; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-fill.on-track { background: #27ae60; }
.progress-fill.behind { background: #f39c12; }
.progress-fill.critical { background: #e74c3c; }

/* ===== TARGET SETTING ===== */
.target-category { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 15px; }
.target-category-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; cursor: pointer; border-bottom: 1px solid var(--border); }
.target-category-header h4 { color: var(--primary); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.target-category-body { padding: 15px 20px; }
.metric-row { display: flex; align-items: center; gap: 15px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.metric-row:last-child { border-bottom: none; }
.metric-label { flex: 1; font-size: 13px; font-weight: 500; min-width: 150px; }
.metric-input { width: 100px; }
.metric-input input { width: 100%; padding: 6px 10px; font-size: 13px; text-align: right; border: 1px solid var(--border); border-radius: 4px; }
.metric-achieved { font-size: 12px; color: var(--text-light); min-width: 80px; text-align: right; }
.metric-pct { font-size: 12px; font-weight: 600; min-width: 50px; text-align: right; }

/* ===== FLP DETAIL ROW ===== */
.flp-detail-row { background: #faf5f9; }
.flp-detail-row td { padding: 0 !important; }
.flp-detail-content { padding: 15px 20px; }
.flp-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.flp-metric-item { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 8px; background: var(--white); border-radius: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .login-container { flex-direction: column; }
  .login-left { min-height: 200px; }
  .hero-overlay h1 { font-size: 1.5rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .filter-panel { flex-wrap: nowrap; overflow-x: auto; }
  .nav-menu { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  #leafletMap { height: 350px; }
}
