:root {
  --primary: #000000;
  --secondary: #171717;
  --text-main: #171717;
  --text-muted: #737373;
  --bg-main: #ffffff;
  --accent: #2563eb;
  --border: #e5e5e5;
  --radius: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: all 0.3s ease;
}

/* Global Transitions */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover, .nav-link:hover, .mobile-nav-item:hover, .site-card:hover {
    transform: translateY(-2px);
}

/* Modal Transitions */
.modal-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    display: flex !important;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    transform: scale(0.95) translateY(10px);
    opacity: 0;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Nav */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text-main);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #262626;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #fafafa;
}

/* Hero */
.hero {
  padding: 120px 0;
  text-align: center;
}

.hero-tag {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #f4f4f5;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 4.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

/* Auth Cards */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.auth-card {
  background: white;
  padding: 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 1rem;
  display: none;
}

/* Dashboard Modern Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background-color: #f9fafb;
}

@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }
}

.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #f3f4f6;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    padding: 0.75rem 1rem;
    border-right: none;
    border-bottom: 1px solid #f3f4f6;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
  }
}

.sidebar h2.logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.05em;
  margin-bottom: 2rem;
  padding: 0 0.75rem;
}

@media (max-width: 768px) {
  .sidebar h2.logo {
    margin-bottom: 0;
    padding: 0;
  }
}

.sidebar nav {
  flex-grow: 1;
}

@media (max-width: 768px) {
  .sidebar nav {
    display: none; /* Hide standard nav on mobile, use a mobile bar instead or toggle */
  }
  
  /* Mobile Bottom Navigation Bar */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #f3f4f6;
    padding: 0.5rem;
    justify-content: space-around;
    z-index: 50;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 0.5rem;
    flex: 1;
  }

  .mobile-nav-item.active {
    color: #2563eb;
    background: #eff6ff;
  }
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 0.25rem;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-link:hover {
  background: #f9fafb;
  color: #111827;
}

.sidebar .nav-link.active {
  background: #eff6ff;
  color: #2563eb;
}

.main-content {
  flex-grow: 1;
  padding: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 768px) {
  .main-content {
    padding: 1.5rem;
    padding-bottom: 5rem; /* Space for mobile nav */
  }
}

/* Modern Plan Badge */
.plan-badge {
  background: #ffffff;
  border: 1px solid #f3f4f6;
  padding: 1rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (max-width: 768px) {
  .plan-badge {
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
  }
  
  .plan-badge .plan-details {
    display: none; /* Hide minor details on mobile header */
  }
}

.plan-info-group {
  display: flex;
  flex-direction: column;
}

.plan-badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.plan-badge-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plan-status-pill {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.status-active {
  background: #dcfce7;
  color: #15803d;
}

/* Header Adjustments */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .header {
    margin-bottom: 1.5rem;
  }
  
  .header h1 {
    font-size: 1.5rem;
  }
}

/* Sites List */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .sites-grid {
    grid-template-columns: 1fr;
  }
}

.site-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.site-card:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Logout Button */
@media (max-width: 768px) {
  #logout-btn {
    width: auto !important;
    margin-top: 0 !important;
    order: 4;
    padding: 0.5rem 1rem;
  }
}

/* Modal Modern */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 75vh;
    padding: 1.5rem;
    margin: 1rem;
    margin-bottom: 5rem;
  }
  
  #template-selection-container {
    grid-template-columns: 1fr !important;
  }
}
