/* =============================================================================
   Movike - Base Styles
   ============================================================================= */

/* =============================================================================
   CSS Variables
   ============================================================================= */
:root {
  /* Primary colors */
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #3B82F6;

  /* Text colors */
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;

  /* Background colors */
  --bg: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;

  /* Border colors */
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  /* Feedback colors */
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  /* Layout */
  --max-width: 1200px;
  --header-height: 60px;
}

/* =============================================================================
   Reset
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg-secondary);
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:hover {
  color: var(--primary-dark);
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* =============================================================================
   App Layout
   ============================================================================= */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#main-content {
  flex: 1;
  padding: var(--space-6);
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* =============================================================================
   Loading Overlay
   ============================================================================= */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* App loading state */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.app-loading-content {
  text-align: center;
}

.app-loading-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-4);
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 40px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

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

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

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 0.75rem;
  min-height: 32px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: 1rem;
  min-height: 48px;
}

.btn-full {
  width: 100%;
}

/* =============================================================================
   Form Elements
   ============================================================================= */
.form-group {
  margin-bottom: var(--space-4);
}

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

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.form-input:disabled {
  background: var(--bg-tertiary);
  cursor: not-allowed;
}

.form-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: var(--space-1);
}

/* =============================================================================
   Header
   ============================================================================= */
.header {
  background: white;
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
}

.header-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.header-logo:hover {
  color: var(--primary-dark);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-nav-item {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

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

.header-nav-item.active {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}

/* =============================================================================
   Footer
   ============================================================================= */
.footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  margin-top: auto;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--primary);
}

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

/* =============================================================================
   Login Form
   ============================================================================= */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 400px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-2);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-6);
}

/* =============================================================================
   Home Page
   ============================================================================= */
.home-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.home-hero {
  text-align: center;
}

.home-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
}

.home-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

/* =============================================================================
   Admin Panel
   ============================================================================= */
.admin-page {
  max-width: 800px;
  margin: 0 auto;
}

.admin-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-6);
}

.admin-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}

.admin-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.admin-welcome {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */
#toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--error);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-info {
  border-left: 4px solid var(--info);
}

.toast-message {
  flex: 1;
  font-size: 0.875rem;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text);
}

/* =============================================================================
   Utilities
   ============================================================================= */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

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

.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 768px) {
  #main-content {
    padding: var(--space-4);
  }

  .header-content {
    padding: 0 var(--space-4);
  }

  .home-title {
    font-size: 2rem;
  }

  .login-card {
    padding: var(--space-6);
    margin: 0 var(--space-4);
  }
}
