/* ====== Base & Variables (Consistent with checkout.css) ====== */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #d89229;
  --accent-700: #b46a18;
  --accent-light: #fffbeb;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #ef4444;
  --info: #111827;
  --border-color: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

html, body {
  margin: 0;
  background-color: var(--bg);
  color: var(--info);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ====== Header (Reused from checkout) ====== */
.app-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.logo { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.logo .mark { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-700)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.logo h1 { margin: 0; font-size: 18px; }
.logo-subtitle { font-size: 12px; color: var(--muted); }
.cart-indicator { text-align: right; }
.cart-indicator-label { font-size: 12px; color: var(--muted); }
.cart-badge { background: var(--accent); color: #fff; padding: 6px 10px; border-radius: 999px; font-weight: 600; }

/* ====== Profile Layout (Mobile-First) ====== */
.profile-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}

/* ====== Sidebar Navigation ====== */
.profile-nav {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.user-info { text-align: center; margin-bottom: 16px; }
.user-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 600; margin: 0 auto 12px; }
.user-name { font-weight: 600; }
.profile-nav nav ul { list-style: none; padding: 0; margin: 0; }
.profile-nav nav li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); transition: background-color 0.2s, color 0.2s; }
.profile-nav nav li:hover { background-color: #f9fafb; }
.profile-nav nav li.active { background-color: var(--accent-light); color: var(--accent-700); }
.logout-section { margin-top: 16px; border-top: 1px solid var(--border-color); padding-top: 16px; }
.logout-btn { width: 100%; }

/* ====== Content Area ====== */
.profile-content .content-section { display: none; }
.profile-content .content-section.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.profile-content h2 { margin-top: 0; font-size: 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* General Card Styling */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-title { margin-top: 0; margin-bottom: 16px; font-size: 18px; }

/* Dashboard Specific */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
.progress-bar { height: 8px; background-color: var(--border-color); border-radius: 99px; overflow: hidden; margin: 16px 0 8px; }
.progress { height: 100%; background-color: var(--success); border-radius: 99px; transition: width 0.5s ease-in-out; }
.progress-steps { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Order History Specific */
.order-list { display: flex; flex-direction: column; gap: 16px; }
.order-card { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; }
.order-card-header { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.order-id { font-weight: 600; }
.order-status { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 99px; }
.order-status.processing, .order-status.pending, .order-status.confirmed { background-color: #eff6ff; color: #1d4ed8; }
.order-status.shipped { background-color: var(--success-light); color: var(--success); }
.order-status.delivered { background-color: #f1f5f9; color: #334155; }
.order-status.cancelled, .order-status.returned { background-color: #fee2e2; color: var(--danger); }
.order-date { font-size: 14px; color: var(--muted); }
.order-total { font-weight: 700; font-size: 18px; }
.order-card-footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Address Management Specific */
.address-list { display: grid; grid-template-columns: 1fr; gap: 16px; }
.address-card { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; position: relative; }
.address-card.is-default { border-color: var(--accent); }
.address-card-header h4 { margin: 0; }
.address-card-default-badge { font-size: 12px; font-weight: 600; background-color: var(--success-light); color: var(--success); padding: 4px 8px; border-radius: 99px; display: none; }
.address-card.is-default .address-card-default-badge { display: inline-block; }
.address-card p { margin: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.address-card-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.address-card .btn-set-default { display: inline-flex; }
.address-card.is-default .btn-set-default { display: none; }

/* Profile Form & Settings */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-group input, .form-group textarea { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); box-sizing: border-box; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); outline: none; }
.form-group input:disabled { background-color: #f8f9fa; cursor: not-allowed; }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border-color); }
.setting-item:last-child { border-bottom: none; }
.setting-item label { font-weight: 600; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #ccc; border-radius: 34px; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: .4s; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; border: none; cursor: pointer; transition: all 0.2s; font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--accent-700); transform: translateY(-1px); }
.btn:focus { box-shadow: 0 0 0 3px var(--accent-light); outline: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent-light); }
.btn.ghost:hover { background: var(--accent-light); }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.modal:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content { width: 100%; max-width: 420px; margin: 20px; transform: scale(0.95); transition: transform 0.3s; }
.modal:not(.hidden) .modal-content { transform: scale(1); }
.modal-actions { margin-top: 24px; display: flex; gap: 8px; justify-content: flex-end; }
.order-item-detail { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.order-item-detail:last-child { border-bottom: none; }

/* ====== Tablet & Desktop Layouts ====== */
@media (min-width: 768px) {
  .container { padding: 24px; }
  .profile-grid { grid-template-columns: 280px 1fr; }
  .order-card-header { flex-direction: row; align-items: center; }
  .address-list { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .container { padding: 32px; }
  .profile-grid { gap: 32px; }
}
