/* ============================================================================
   COMMON STYLES - Global Design System (Enhanced)
   ============================================================================ */

   :root {
    --bg: #f8f7f5;
    --bg-secondary: #f0efec;
    --bg-dark: #1a1a1a;
    --bg-dark-alt: #242424;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --glass: rgba(248,247,245,0.92);

    --text: #1a1a1a;
    --text-secondary: #4b5563;
    --text-tertiary: #8c8c8c;
    --text-inverse: #ffffff;
    --text-muted: rgba(255,255,255,0.65);

    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.12);
    --border-light: rgba(255,255,255,0.12);

    --sale: #1a5f7a;
    --sale-bg: rgba(26,95,122,0.1);
    --seeking: #7a4a1a;
    --seeking-bg: rgba(122,74,26,0.1);

    --accent: #c9a55c;
    --accent-light: rgba(201,165,92,0.15);
    --accent-dark: #a68942;
    --accent-bg: rgba(201,165,92,0.08);

    --success: #2d6a4f;
    --success-bg: rgba(45,106,79,0.1);
    --success-dark: #1e4a36;
    --warning: #b8860b;
    --warning-bg: rgba(184,134,11,0.12);
    --warning-dark: #8a6708;
    --error: #b33a3a;
    --error-bg: rgba(179,58,58,0.1);
    --error-light: rgba(179,58,58,0.2);
    --info: #2563eb;
    --info-bg: rgba(37,99,235,0.1);
    --info-dark: #1d4ed8;

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 100px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.12);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 0.25s;
    --duration-slow: 0.4s;
    --duration-slower: 0.6s;

    --sidebar-w: 260px;
    --header-h: 64px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body { 
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif; 
    color: var(--text); 
    line-height: 1.65; 
    min-height: 100vh; 
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
}
.serif { font-family: 'Cormorant Garamond', Georgia, serif; }
h1, h2, h3, h4, h5 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent-light); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.hidden { display: none !important; }

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* Buttons */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 12px 24px; 
    border-radius: var(--radius-full); 
    font-size: 14px; 
    font-weight: 500; 
    border: none; 
    cursor: pointer; 
    transition: all var(--duration) var(--ease); 
    white-space: nowrap; 
    text-decoration: none; 
    -webkit-tap-highlight-color: transparent; 
    touch-action: manipulation;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-xs { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }

.btn-primary { background: var(--bg-dark); color: var(--text-inverse); }
.btn-primary:hover:not(:disabled) { background: #2a2a2a; transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.btn-secondary { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text-secondary); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text); color: var(--text); }

.btn-accent { background: var(--accent); color: var(--text-inverse); }
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }

.btn-danger { background: var(--error); color: var(--text-inverse); }
.btn-danger:hover:not(:disabled) { background: #9a3030; }

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

.btn-light { background: rgba(255,255,255,0.12); color: var(--text-inverse); border: 1px solid rgba(255,255,255,0.15); }
.btn-light:hover:not(:disabled) { background: rgba(255,255,255,0.2); }

.btn-outline { 
    background: transparent; 
    color: var(--text-inverse); 
    border: 1.5px solid rgba(255,255,255,0.3);
}
.btn-outline:hover:not(:disabled) { 
    background: rgba(255,255,255,0.1); 
    border-color: rgba(255,255,255,0.5);
}

.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { 
    content: ''; 
    position: absolute; 
    width: 18px; 
    height: 18px; 
    border: 2px solid currentColor; 
    border-top-color: transparent; 
    border-radius: 50%; 
    animation: spin 0.7s linear infinite; 
}
.btn-primary.loading::after { border-color: rgba(255,255,255,0.3); border-top-color: white; }

/* Tags & Badges */
.tag { 
    display: inline-flex; 
    align-items: center; 
    gap: 4px; 
    padding: 4px 10px; 
    border-radius: var(--radius-full); 
    font-size: 11px; 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.03em;
}
.tag-sale { background: var(--sale); color: rgba(255,255,255,0.95); }
.tag-seeking { background: var(--seeking); color: rgba(255,255,255,0.95); }
.tag-pending { background: var(--warning-bg); color: var(--warning); }
.tag-active { background: var(--success-bg); color: var(--success); }
.tag-direct { background: var(--success-bg); color: var(--success); }
.tag-exclusive { background: rgba(139,92,246,0.1); color: #7c3aed; }
.tag-rejected, .tag-declined { background: var(--error-bg); color: var(--error); }
.tag-expired { background: var(--bg); color: var(--text-tertiary); }
.tag-delivered { background: rgba(59,130,246,0.1); color: #2563eb; }
.tag-accepted { background: var(--success-bg); color: var(--success); }
.tag-successful { background: rgba(217,119,6,0.15); color: #b45309; }
.tag-hidden { background: var(--bg); color: var(--text-tertiary); }
.tag-demo { 
    background: var(--accent-light); 
    color: var(--accent-dark); 
    border: 1px solid var(--accent);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-waitlist { background: var(--bg); color: var(--text-tertiary); }
.badge-banned { background: var(--error-bg); color: var(--error); }
.badge-delivered { background: rgba(59,130,246,0.1); color: #2563eb; }
.badge-rejected, .badge-declined { background: var(--error-bg); color: var(--error); }
.badge-expired { background: var(--bg); color: var(--text-tertiary); }
.badge-accepted { background: var(--success-bg); color: var(--success); }
.badge-successful { background: rgba(217,119,6,0.15); color: #b45309; }

.mini-tag {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { 
    display: block; 
    margin-bottom: 6px; 
    font-size: 13px; 
    font-weight: 500; 
    color: var(--text);
}
.form-label .req { color: var(--error); }
.form-label .opt { color: var(--text-tertiary); font-weight: 400; }

.form-input { 
    width: 100%; 
    padding: 12px 14px; 
    background: var(--surface); 
    border: 1.5px solid var(--border); 
    border-radius: var(--radius-sm); 
    font-size: 14px; 
    color: var(--text); 
    transition: all var(--duration) var(--ease);
}
.form-input::placeholder { color: var(--text-tertiary); }
.form-input:hover { border-color: var(--border-strong); }
.form-input:focus { 
    outline: none; 
    border-color: var(--text); 
    box-shadow: 0 0 0 3px rgba(26,26,26,0.06);
}
.form-input.error { border-color: var(--error); }

textarea.form-input { 
    min-height: 100px; 
    resize: vertical; 
    line-height: 1.5;
}

.form-hint { 
    margin-top: 6px; 
    font-size: 12px; 
    color: var(--text-tertiary); 
    line-height: 1.4;
}

.field-error { 
    margin-top: 6px; 
    font-size: 12px; 
    color: var(--error); 
    display: none;
}
.field-error.show { display: block; }

.agreement {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}
.agreement input {
    margin-top: 2px;
}

/* Toggle Switch */
.toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.toggle input {
    display: none;
}
.toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: background var(--duration);
}
.toggle-track:before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration);
}
.toggle input:checked + .toggle-track {
    background: var(--accent);
}
.toggle input:checked + .toggle-track:before {
    transform: translateX(20px);
}
.toggle.large {
    transform: scale(1.2);
}
.toggle.large .toggle-label {
    margin-left: 12px;
    font-weight: 500;
    font-size: 14px;
}
.toggle-text {
    display: flex;
    flex-direction: column;
}
.toggle-label {
    font-weight: 500;
    font-size: 14px;
}
.toggle-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Button Groups & Options */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.btn-opt {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all var(--duration);
}
.btn-opt:hover {
    border-color: var(--border-strong);
}
.btn-opt.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-dark);
}
.btn-opt strong {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}
.btn-opt small {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

.toggle-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-md);
}
.toggle-box.active {
    background: var(--accent-light);
    border-color: var(--accent);
}

/* Modals */
.modal { 
    display: none; 
    position: fixed; 
    inset: 0; 
    z-index: 1000; 
    padding: 20px; 
    overflow-y: auto; 
    align-items: center; 
    justify-content: center;
}
.modal.active { display: flex; }

.modal-bg { 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-box { 
    position: relative; 
    background: var(--surface); 
    border-radius: var(--radius-xl); 
    max-width: 420px; 
    width: 100%; 
    max-height: 85vh;
    padding: 32px; 
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s var(--ease-out);
    display: flex;
    flex-direction: column;
}

.modal-box.md { max-width: 540px; }
.modal-box.lg { max-width: 720px; }

.modal-close { 
    position: absolute; 
    top: 20px; 
    right: 20px; 
    background: none; 
    border: none; 
    color: var(--text-tertiary); 
    cursor: pointer; 
    padding: 8px; 
    border-radius: var(--radius-sm); 
    transition: all var(--duration);
}
.modal-close:hover { color: var(--text); background: var(--bg); }

.modal-head { margin-bottom: 24px; text-align: center; }
.modal-title { font-size: 24px; margin-bottom: 6px; }
.modal-subtitle { font-size: 14px; color: var(--text-secondary); }
.modal-body { 
    padding: 0; 
    flex: 1;
    overflow-y: auto;
    max-height: calc(85vh - 180px);
}
.modal-scroll { 
    padding-right: 8px;
}

.modal-footer-text { 
    text-align: center; 
    margin-top: 20px; 
    font-size: 13px; 
    color: var(--text-secondary);
}
.modal-footer-text a { color: var(--accent-dark); font-weight: 500; }
.modal-footer-text a:hover { text-decoration: underline; }

/* Toast Notifications */
.toast-box { 
    position: fixed; 
    bottom: 24px; 
    right: 24px; 
    z-index: 2000; 
    display: flex; 
    flex-direction: column; 
    gap: 10px;
    max-width: 360px;
}

.toast { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 14px 18px; 
    background: var(--surface); 
    border: 1px solid var(--border);
    border-radius: var(--radius-md); 
    box-shadow: var(--shadow-md); 
    font-size: 14px; 
    animation: fadeIn 0.3s var(--ease-out);
}

.toast.hiding {
    animation: fadeIn 0.3s var(--ease-out) reverse;
}

.toast svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.toast span {
    flex: 1;
    line-height: 1.4;
}

.toast.success { 
    background: var(--success-bg); 
    border-color: rgba(45,106,79,0.2); 
    color: var(--success);
}
.toast.error { 
    background: var(--error-bg); 
    border-color: rgba(179,58,58,0.2); 
    color: var(--error);
}
.toast.warning { 
    background: var(--warning-bg); 
    border-color: rgba(184,134,11,0.2); 
    color: var(--warning);
}
.toast.info { 
    background: rgba(59,130,246,0.1); 
    border-color: rgba(59,130,246,0.2); 
    color: #2563eb;
}

/* Price Formatting */
.price-amount {
    font-weight: 700;
    color: var(--text);
}

.price-suffix {
    font-size: 0.8em;
    opacity: 0.9;
    font-weight: 600;
}

/* Utility Classes */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }
.ml-3 { margin-left: 24px; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }