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

/* ==================== CSS Variables ==================== */
:root {
  --primary: #EF4444;
  /* red-500 */
  --primary-light: #F87171;
  /* red-400 */
  --primary-dark: #DC2626;
  /* red-600 */
  --accent: #111827;
  /* dark slate */
  --accent-light: #374151;
  --accent-dark: #000000;

  --bg: #F9FAFB;
  /* gray-50 */
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-dark: rgba(239, 68, 68, 0.05);

  --text: #111827;
  --text-muted: #4B5563;
  --text-light: #9CA3AF;

  --border: #E5E7EB;
  /* gray-200 */
  --border-focus: rgba(239, 68, 68, 0.5);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-btn: 0 4px 14px 0 rgba(239, 68, 68, 0.39);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --font: 'Inter', sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-logo {
  background: url(../media/logo.png);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  width: 301px;
  height: 55px;
}

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

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

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

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  /* gray-300 */
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
  /* gray-400 */
}

/* ==================== Typography ==================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

/* ==================== Glassmorphism Card ==================== */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ==================== Header ==================== */
.header {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.025em;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.25rem;
  touch-action: manipulation;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-1px);
}

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

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

.btn-danger:hover {
  background: var(--accent-light);
  color: white;
}

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

.btn-outline:hover {
  background: var(--bg-card);
  border-color: #D1D5DB;
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: #F3F4F6;
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  gap: 0;
}

.btn-full {
  width: 100%;
}

/* ==================== Forms ==================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  transition: all var(--transition);
  outline: none;
  box-shadow: var(--shadow-sm);
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-control::placeholder {
  color: var(--text-light);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* ==================== Checkbox & Radio ==================== */
.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  user-select: none;
}

.checkbox-label input,
.radio-label input {
  display: none;
}

.custom-check,
.custom-radio {
  width: 18px;
  height: 18px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  touch-action: manipulation;
}

.custom-radio {
  border-radius: 50%;
}

.checkbox-label input:checked~.custom-check,
.radio-label input:checked~.custom-radio {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked~.custom-check::after {
  content: url('data:image/svg+xml;charset=UTF-8,<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>');
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-label input:checked~.custom-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  display: block;
}

/* ==================== Badge / Status ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}

.badge-new {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.badge-processing {
  background: #FFFBEB;
  color: #D97706;
  border: 1px solid #FDE68A;
}

.badge-ready {
  background: #EEF2FF;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
}

.badge-done {
  background: #F3F4F6;
  color: #4B5563;
  border: 1px solid #E5E7EB;
}

/* ==================== Toast / Notifications ==================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideInRight 0.25s ease, fadeOut 0.3s ease 3s forwards;
  pointer-events: all;
  min-width: 280px;
  max-width: 380px;
}

.toast-success {
  border-left: 4px solid #10B981;
}

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

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

@keyframes slideInRight {
  from {
    transform: translateX(110%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(110%);
  }
}

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  opacity: 0;
  transition: all var(--transition);
}

.modal-overlay.open .modal {
  transform: scale(1);
  opacity: 1;
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #F9FAFB;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  touch-action: manipulation;
}

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

/* ==================== Layout ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-header {
  padding: 40px 0 24px;
}

.page-header h1 {
  margin-bottom: 8px;
}

/* ==================== Loading Spinner ==================== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #E5E7EB;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== Empty State ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 64px 24px;
  color: var(--text-muted);
  text-align: center;
  background: white;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}

.empty-state-icon {
  color: #D1D5DB;
  margin-bottom: 8px;
}

.empty-state h3 {
  color: var(--text);
  font-weight: 600;
}

.empty-state p {
  max-width: 320px;
  font-size: 0.875rem;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .header-nav {
    width: 100%;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
  }

  .logo {
    font-size: 1.1rem;
  }

  .container {
    padding: 0 16px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .page-header {
    padding: 24px 0 16px;
  }

  .form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px !important;
  }
}

/* ==================== AI Button ==================== */
.ai-btn {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--primary);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  touch-action: manipulation;
}

.ai-btn:hover {
  background: var(--bg);
  color: var(--primary-dark);
  border-color: var(--primary-light);
}

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

/* ==================== Checkout Page ==================== */
.checkout-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.checkout-card {
  padding: 32px;
  margin-top: 24px;
}

.checkout-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.radio-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.order-summary-mini {
  padding: 16px 20px;
  background: var(--bg-glass-dark);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.os-info {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.os-price {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.os-discount {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 600;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
}

.consent-row input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.consent-row label {
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.5;
}

.consent-row label a {
  color: var(--primary);
  font-weight: 600;
}

.form-error {
  font-size: 0.8rem;
  color: var(--primary);
  margin-top: 5px;
  display: none;
}

.form-control.invalid {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.success-screen {
  text-align: center;
  padding: 60px 24px;
  display: none;
}

.success-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #10B981;
  margin-bottom: 20px;
}

.success-screen h2 {
  margin-bottom: 10px;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--primary);
}

/* ==================== Cabinet Page ==================== */
.cabinet-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
}

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid white;
  box-shadow: var(--shadow-sm);
}

.user-info h1 {
  margin-bottom: 4px;
  font-size: 1.8rem;
}

.user-info p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.order-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

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

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.order-id {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.order-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.order-status {
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-new {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.status-processing {
  background: #FFFBEB;
  color: #D97706;
  border: 1px solid #FDE68A;
}

.status-ready {
  background: #EEF2FF;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
}

.status-done {
  background: #F3F4F6;
  color: #4B5563;
  border: 1px solid #E5E7EB;
}

.order-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.order-total {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.order-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

.order-photos-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.order-photos-preview img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
}

.more-photos {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.btn-logout {
  background: url(../media/exit.svg);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  width: 21px;
  height: 23px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}