/* ==========================================================================
   🏠 DormHome Hub - Premium Minimalist Collapsible Left Sidebar Layout (Ver 4.0)
   PC, iPad & Mobile Universal Responsive Support
   ========================================================================== */

:root {
  /* Clean Monochrome & Muted Slate Palette */
  --bg-main: #f8fafc;           /* Pure Soft Slate Background */
  --bg-card: #ffffff;           /* Crisp White Container */
  --text-dark: #0f172a;         /* Deep Slate 900 */
  --text-body: #334155;         /* Slate 700 */
  --text-muted: #64748b;        /* Slate 500 */
  
  --border-subtle: #e2e8f0;     /* Neutral Subtle Border */
  --border-card: #cbd5e1;       /* Neutral Card Border */
  
  --primary: #4f46e5;           /* Indigo 600 */
  --primary-hover: #4338ca;     /* Indigo 700 */
  
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 68px;
  
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.06);
  --radius-lg: 12px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.5;
  font-size: 0.94rem;
  min-height: 100vh;
  overflow-x: hidden;
}

/* App Outer Flex Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   📐 Collapsible Left Sidebar Styles
   ========================================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 150;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  overflow: hidden;
}

/* Collapsed Sidebar State */
.app-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-text {
  transition: opacity 0.2s ease, width 0.2s ease;
}

.app-sidebar.collapsed .brand-text {
  opacity: 0;
  width: 0;
  display: none;
}

.sidebar-toggle-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #e2e8f0;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  width: 100%;
  text-align: left;
}

.nav-tab:hover {
  background: #f1f5f9;
  color: var(--text-dark);
}

.nav-tab.active {
  background: var(--text-dark);
  color: #ffffff;
  border-color: var(--text-dark);
}

.tab-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
}

.tab-label {
  transition: opacity 0.2s ease;
}

.app-sidebar.collapsed .tab-label {
  opacity: 0;
  display: none;
}

.app-sidebar.collapsed .nav-tab {
  padding: 10px;
  justify-content: center;
}

/* Sidebar Footer Actions */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-admin-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  width: 100%;
  white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-admin-btn .tab-label {
  display: none;
}

.app-sidebar.collapsed .sidebar-admin-btn {
  justify-content: center;
  padding: 10px;
}

/* ==========================================================================
   🖥️ Main Content Wrapper
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-main);
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-sidebar-toggle {
  display: none;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-selector-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
}

.profile-selector-btn:hover {
  background: #e2e8f0;
}

/* Alert Banner */
.top-alert-banner {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 24px;
  font-size: 0.86rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Main Content Views */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
}

/* Storage Grid Container */
.storage-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px !important;
}

.zone-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.item-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.storage-item-card {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.item-thumb {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.item-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
}

.item-owner {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.dash-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
}

/* Status Tags */
.status-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tag-normal { background: #f1f5f9; color: #475569; }
.tag-success { background: #d1fae5; color: #065f46; }
.tag-danger { background: #fee2e2; color: #991b1b; }
.tag-warning { background: #fef3c7; color: #92400e; }

/* Buttons */
.btn-primary {
  background: var(--text-dark);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #1e293b;
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-dark);
  border: 1px solid var(--border-card);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-accent {
  background: #be123c;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-card);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-dark);
}

.form-input, .form-select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  font-size: 0.9rem;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 240px !important;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  .mobile-sidebar-toggle {
    display: inline-flex;
  }
  .main-content {
    padding: 16px;
  }
}

/* ==========================================================================
   💰 Financial Settlement & Analytics Dashboard Styles
   ========================================================================== */
.financial-subtab {
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.financial-subtab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.kpi-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #10b981);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.tag-pending {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.tag-paid {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.tag-priority {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.receipt-thumb-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.receipt-thumb-img:hover {
  transform: scale(1.1);
}

