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

:root {
  /* Color Palette */
  --color-primary: #00B8A9;       /* Vibrant Teal */
  --color-primary-dark: #008B80;
  --color-primary-light: #E0F7F5;
  --color-secondary: #0B1E3E;     /* Deep Navy */
  --color-bg: #F8FAFC;            /* Slate 50 */
  --color-surface: #FFFFFF;
  --color-text: #334155;          /* Slate 700 */
  --color-text-muted: #64748B;    /* Slate 500 */
  --color-text-heading: #0F172A;  /* Slate 900 */
  --color-error: #EF4444;         /* Red 500 */
  --color-error-bg: #FEF2F2;      /* Red 50 */
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glass: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* -----------------------------
   Layouts
----------------------------- */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Premium dynamic background */
  background: linear-gradient(135deg, var(--color-secondary) 0%, #1e3a8a 100%);
  position: relative;
  overflow: hidden;
}

.auth-layout::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
  opacity: 0.3;
  filter: blur(80px);
  animation: float 10s infinite alternate ease-in-out;
}

.auth-layout::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  opacity: 0.3;
  filter: blur(80px);
  animation: float 12s infinite alternate-reverse ease-in-out;
}

@keyframes float {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, 30px); }
}

/* -----------------------------
   Components
----------------------------- */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  width: 100%;
  max-width: 440px;
  padding: 3rem 2.5rem;
  position: relative;
  z-index: 10;
  transform: translateY(20px);
  opacity: 0;
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text-heading);
  background-color: var(--color-bg);
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 184, 169, 0.15);
  background-color: var(--color-surface);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  width: 100%;
  box-shadow: 0 4px 6px -1px rgba(0, 184, 169, 0.2);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(0, 184, 169, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.alert {
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeIn 0.4s ease forwards;
}

.alert-error {
  background-color: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid #FECACA;
}

.alert-success {
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
  border: 1px solid #99F6E4;
}

.alert-warning {
  background-color: #FEF3C7;
  color: #D97706;
  border: 1px solid #FDE68A;
}

.alert-info {
  background-color: #E0E7FF;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 0.875rem; }

/* Dynamic Brand */
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: 20px;
  color: white;
  font-size: 32px;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 184, 169, 0.3);
  transform: rotate(-5deg);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-card:hover .brand-logo {
  transform: rotate(0deg) scale(1.05);
}

/* -----------------------------
   App Layout (Sidebar + Topbar)
----------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--color-surface);
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text-heading);
  line-height: 1.2;
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  background-color: var(--color-surface);
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.page-content {
  padding: 2rem;
  flex: 1;
}

/* -----------------------------
   Dashboard Cards
----------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.stat-info h3 {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-heading);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.icon-blue { background: #DBEAFE; color: #2563EB; }
.icon-green { background: #D1FAE5; color: #059669; }
.icon-yellow { background: #FEF3C7; color: #D97706; }
.icon-red { background: #FEE2E2; color: #DC2626; }
.icon-teal { background: var(--color-primary-light); color: var(--color-primary); }

/* Tables */
.table-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid #E2E8F0;
  overflow: hidden;
}

.table-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid #E2E8F0;
}

th {
  background: #F8FAFC;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
}

td {
  font-size: 0.875rem;
  color: var(--color-text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-unpaid { background: #FEE2E2; color: #991B1B; }
.badge-partial { background: #FEF3C7; color: #92400E; }
.badge-paid { background: #D1FAE5; color: #065F46; }

/* -----------------------------
   Dark Theme Overrides
----------------------------- */
body.dark-theme {
  --color-bg: #0F172A;            /* Slate 900 */
  --color-surface: #1E293B;       /* Slate 800 */
  --color-text: #CBD5E1;          /* Slate 300 */
  --color-text-muted: #94A3B8;    /* Slate 400 */
  --color-text-heading: #F8FAFC;  /* Slate 50 */
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-glass: 0 25px 50px -12px rgb(0 0 0 / 0.7);
}

body.dark-theme .glass-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .sidebar {
  border-right-color: #334155;
}

body.dark-theme .topbar,
body.dark-theme .sidebar-header,
body.dark-theme .table-header {
  border-bottom-color: #334155;
}

body.dark-theme .stat-card,
body.dark-theme .table-container,
body.dark-theme .form-control {
  border-color: #334155;
}

body.dark-theme th {
  background: #0F172A;
}

body.dark-theme tbody tr:hover {
  background: #0F172A;
}

body.dark-theme td,
body.dark-theme th {
  border-bottom-color: #334155;
}

body.dark-theme .form-control {
  background-color: #0F172A;
}

body.dark-theme .form-control:focus {
  background-color: #1E293B;
}
