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

/* ==========================================
   LOVABLE DESIGN SYSTEM VARIABLES
   ========================================== */
:root {
  /* Typography */
  --font-heading: 'Outfit', 'Camera Plain Variable', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Outfit', 'Camera Plain Variable', ui-sans-serif, system-ui, sans-serif;

  /* Theme Core: Cream & Parchment System (Default) */
  --bg-app: #f7f4ed; /* The signature warm paper background */
  --bg-surface: #fcfbf8; /* Barely lighter surface */
  --bg-card: #f7f4ed; /* Cards blend into page or stand out via borders */
  --primary: var(--charcoal); /* Active brand tone */
  --border-color: #eceae4; /* Passive dividers and card borders */
  --border-interactive: rgba(28, 28, 28, 0.4); /* Border for inputs and outline buttons */
  
  /* Primary & Text tones (Opacity-based from Charcoal #1c1c1c) */
  --charcoal: #1c1c1c;
  --text-primary: #1c1c1c;
  --text-secondary: rgba(28, 28, 28, 0.83); /* Strong secondary text */
  --text-body: rgba(28, 28, 28, 0.82); /* Body copy */
  --text-muted: #5f5f5d; /* Secondary text, descriptions, captions */
  
  --bg-hover: rgba(28, 28, 28, 0.04); /* Charcoal 4% hover tint */
  --bg-tint: rgba(28, 28, 28, 0.03); /* Charcoal 3% overlay depth */

  /* Status Colors (Muted to fit warm aesthetic) */
  --color-pass: #10b981;    /* Emerald green */
  --color-warn: #d97706;    /* Warm Amber */
  --color-fail: #dc2626;    /* Warm Red */
  --color-info: #2563eb;    /* Warm Blue */

  /* Inset & Depth Shadows */
  --inset-shadow: rgba(255, 255, 255, 0.2) 0px 0.5px 0px 0px inset, 
                  rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px inset, 
                  rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
  --focus-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
  --ring-color: rgba(59, 130, 246, 0.5); /* Soft blue ring */

  /* Dimensions & Scales */
  --sidebar-width: 280px;
  --header-height: 70px;
  
  --radius-pill: 9999px;
  --radius-container: 16px;
  --radius-card: 12px;
  --radius-compact: 8px;
  --radius-btn: 6px;
  --radius-input: 6px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme (Zinc/Graphite warm dark tone, still retaining Lovable layout shapes) */
.light-theme {
  --bg-app: #121212;
  --bg-surface: #1e1e1e;
  --bg-card: #18181b;
  --primary: var(--charcoal);
  --border-color: #27272a;
  --border-interactive: rgba(255, 255, 255, 0.4);
  
  --charcoal: #f4f4f5;
  --text-primary: #f4f4f5;
  --text-secondary: rgba(244, 244, 245, 0.85);
  --text-body: rgba(244, 244, 245, 0.8);
  --text-muted: #a1a1aa;
  
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-tint: rgba(255, 255, 255, 0.03);

  --color-pass: #34d399;
  --color-warn: #fbbf24;
  --color-fail: #f87171;
  --color-info: #60a5fa;

  --inset-shadow: rgba(255, 255, 255, 0.05) 0px 0.5px 0px 0px inset, 
                  rgba(0, 0, 0, 0.4) 0px 0px 0px 0.5px inset, 
                  rgba(0, 0, 0, 0.2) 0px 1px 2px 0px;
  --focus-shadow: rgba(0, 0, 0, 0.4) 0px 4px 12px;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  letter-spacing: -0.01em; /* Subtle humanist compression globally */
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-body);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 600;
}

a {
  text-decoration: none;
  color: var(--text-primary);
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.85;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  border: none;
  background: transparent;
}

button {
  cursor: pointer;
}

/* Custom Scrollbar to fit analog cream theme */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-interactive);
}

/* ==========================================
   LAYOUT STRUCTURE
   ========================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Drawer Style */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-app);
  border-right: 1px solid var(--border-color);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--charcoal);
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-app);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--inset-shadow);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px 8px 6px 8px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-left: 2px solid var(--text-primary);
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
  padding-left: 10px;
}

.nav-item i {
  font-size: 1.1rem;
  width: 18px;
  text-align: center;
  color: var(--text-primary);
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-interactive);
}

/* Content Frame Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-normal);
  background-color: var(--bg-app);
}

/* View Sections */
.view-section {
  display: none;
  flex-grow: 1;
  animation: fadeIn var(--transition-normal) forwards;
}

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

/* ==========================================
   LOVABLE CARD & CONTAINER DESIGN SYSTEM
   ========================================== */
.glass-card {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px;
  /* Shallow depth: no heavy shadow. Containment is handled by borders */
  box-shadow: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.glass-card:hover {
  border-color: var(--border-interactive);
}

/* Large Container Card */
.container-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-container);
  padding: 32px;
  background: var(--bg-app);
}

/* Interactive Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-weight: 500;
  transition: all var(--transition-fast);
  font-size: 0.95rem;
  font-family: var(--font-body);
}

/* Primary Dark with Inset Shadow */
.btn-primary {
  background: var(--charcoal);
  color: #fcfbf8; /* Off-White label */
  box-shadow: var(--inset-shadow);
  border: none;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-primary:active {
  opacity: 0.75;
}

.btn-primary:focus {
  box-shadow: var(--inset-shadow), var(--focus-shadow);
}

/* Ghost / Outline Button */
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-interactive);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-secondary:active {
  opacity: 0.8;
}

/* Cream surface / Utility Button */
.btn-cream {
  background: var(--bg-app);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-cream:hover {
  background: var(--border-color);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--color-fail);
  color: var(--color-fail);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.05);
}

/* Badge System - Pill style */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-pass {
  background: rgba(16, 185, 129, 0.08);
  color: var(--color-pass);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warn {
  background: rgba(217, 119, 6, 0.08);
  color: var(--color-warn);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-fail {
  background: rgba(220, 38, 38, 0.08);
  color: var(--color-fail);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-info {
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-info);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Form inputs & controls */
.input-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-control {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.input-control:focus {
  border-color: var(--border-interactive);
  box-shadow: var(--focus-shadow);
}

.input-control::placeholder {
  color: var(--text-muted);
}

select.input-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231c1c1c'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
}

/* Modals Overlay style */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 28, 28, 0.4); /* Charcoal overlay */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--transition-fast) forwards;
}

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

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-container);
  width: 100%;
  max-width: 540px;
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--focus-shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close-btn {
  font-size: 1.25rem;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile responsive hamburger menu elements */
.mobile-header {
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
}

/* ==========================================
   RESPONSIVE MEDIA QUERIES
   ========================================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    background: var(--bg-surface);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding-top: var(--header-height);
  }
  
  .mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
  }

  .burger-menu {
    display: block;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    display:flex;
    align-items:center;
    justify-content:center;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 28, 28, 0.3);
  backdrop-filter: blur(2px);
  z-index: 98;
}

.sidebar-overlay.open {
  display: block;
}
