/* ==========================================================================
   MD Furniture Brief — Clean Luxury Design System (No Glows)
   Direction: RTL | Palette: Obsidian Dark & Burnished Champagne Gold (#c98d5f)
   Fonts: Tajawal & IBM Plex Sans Arabic
   ========================================================================== */

:root {
    /* Brand Metallic Palette */
    --gold-primary: #c98d5f;
    --gold-light: #dfa87a;
    --gold-dark: #965f35;
    --gold-cream: #f4e3d3;
    --gold-bg-subtle: rgba(201, 141, 95, 0.12);
    --gold-border: rgba(201, 141, 95, 0.25);
    --gold-border-active: rgba(201, 141, 95, 0.7);

    /* Dark Obsidian Grayscale */
    --bg-obsidian: #0a0b0e;
    --bg-card: #12141c;
    --bg-card-hover: #161824;
    --bg-input: #0e1017;
    --bg-input-focus: #141622;
    
    /* Hairline Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(201, 141, 95, 0.18);

    /* Typography Colors */
    --text-white: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-gold: #c98d5f;

    /* Status Colors */
    --success: #10b981;
    --danger: #ef4444;

    /* Layout Geometry */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;

    /* Crisp Clean Shadows (Zero Glow) */
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-btn: 0 4px 14px rgba(0, 0, 0, 0.35);

    --font-heading: 'Tajawal', 'IBM Plex Sans Arabic', sans-serif;
    --font-body: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
}

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

html {
    direction: rtl;
    text-align: right;
    font-size: 16px;
    scroll-behavior: smooth;
}

body.fb-front-page-body,
body.fb-body-wrapper {
    font-family: var(--font-body);
    background-color: var(--bg-obsidian);
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-obsidian);
}
::-webkit-scrollbar-thumb {
    background: #1e212d;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
}

/* ==========================================================================
   Header Navbar (No Glow, Clean Border)
   ========================================================================== */
.fb-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(14, 16, 24, 0.95);
    border-bottom: 1px solid var(--border-card);
    padding: 16px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.fb-nav-container {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fb-nav-brand {
    display: flex;
    align-items: center;
}

.fb-brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-white);
    letter-spacing: -0.01em;
}

.fb-nav-progress {
    display: flex;
    align-items: center;
}

.fb-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 18px;
    background: var(--gold-bg-subtle);
    color: var(--gold-primary);
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 700;
    border: 1px solid var(--gold-border);
}

.fb-progress-pill .dot {
    width: 8px;
    height: 8px;
    background-color: var(--gold-primary);
    border-radius: 50%;
}

/* ==========================================================================
   Main Container Layout
   ========================================================================== */
.fb-main-content {
    padding: 40px 16px 90px;
}

.fb-container {
    max-width: 920px;
    margin: 0 auto;
}

.fb-header {
    text-align: center;
    margin-bottom: 36px;
    padding: 20px 0;
}

.fb-header h1 {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.fb-header p {
    font-size: 1.05rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Clean Luxury Cards (No Glows)
   ========================================================================== */
.fb-form {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.fb-card,
.fb-section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 34px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.fb-card:hover,
.fb-section-card:hover {
    border-color: var(--gold-border-active);
}

.fb-card-header,
.fb-card-title {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px dashed rgba(201, 141, 95, 0.2);
}

.fb-step-badge,
.step-number {
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: var(--gold-bg-subtle);
    color: var(--gold-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.2rem;
    border: 1.5px solid var(--gold-border);
}

.fb-card-header h2,
.fb-card-title span {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
}

.fb-card-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.optional-badge {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--gold-primary);
    background: var(--gold-bg-subtle);
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid var(--gold-border);
    margin-right: auto;
}

/* Form Controls */
.fb-form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.fb-form-group:last-child {
    margin-bottom: 0;
}

.fb-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-white);
}

.fb-label .required {
    color: var(--gold-primary);
    margin-right: 4px;
}

.fb-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.fb-input-icon {
    position: absolute;
    left: 16px;
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    pointer-events: none;
}

.fb-input-text,
.fb-select,
.fb-textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1.02rem;
    padding: 16px 20px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-input);
    color: var(--text-white);
    outline: none;
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.fb-input-wrapper .fb-input-text {
    padding-left: 48px;
}

.fb-input-text::placeholder,
.fb-textarea::placeholder {
    color: #475569;
}

.fb-input-text:focus,
.fb-select:focus,
.fb-textarea:focus {
    border-color: var(--gold-primary);
    background-color: var(--bg-input-focus);
}

.fb-input-wrapper:focus-within .fb-input-icon {
    color: var(--gold-primary);
}

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

.fb-select-wrapper {
    position: relative;
}

.fb-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2523c98d5f'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 18px center;
    background-size: 20px;
    padding-left: 48px;
}

.fb-select option {
    background-color: var(--bg-card);
    color: var(--text-white);
}

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

/* Style Visual Cards Selector (Fixed Active Icon, No Glow) */
.fb-style-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.fb-style-card {
    position: relative;
    cursor: pointer;
}

.fb-style-card input[type="radio"],
.fb-radio-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.fb-style-card-inner,
.fb-radio-label {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    transition: border-color 0.25s ease, background-color 0.25s ease;
    height: 100%;
}

.fb-radio-label {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    font-weight: 600;
    color: var(--text-secondary);
}

.fb-style-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    transition: all 0.25s ease;
}

.fb-style-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.fb-style-card input[type="radio"]:checked + .fb-style-card-inner,
.fb-radio-btn input[type="radio"]:checked + .fb-radio-label {
    border-color: var(--gold-primary);
    background: var(--gold-bg-subtle);
    color: var(--gold-primary);
}

.fb-style-card input[type="radio"]:checked + .fb-style-card-inner .fb-style-icon {
    background: rgba(201, 141, 95, 0.2);
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

/* Example Chips */
.fb-example-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.chip-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.fb-chip {
    font-family: var(--font-body);
    font-size: 0.82rem;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.fb-chip:hover {
    background: var(--gold-bg-subtle);
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

/* Colour Radio Options */
.fb-colour-options,
.fb-radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.fb-colour-card {
    position: relative;
    cursor: pointer;
}

.fb-colour-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.fb-colour-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    transition: border-color 0.25s ease;
}

.fb-colour-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-accurate { background: #3b82f6; }
.dot-lighter  { background: #93c5fd; }
.dot-darker   { background: #1e3a8a; }
.dot-custom   { background: linear-gradient(135deg, #c98d5f, #ef4444); }

.fb-colour-text {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.fb-colour-card input[type="radio"]:checked + .fb-colour-inner {
    border-color: var(--gold-primary);
    background: var(--gold-bg-subtle);
}

.fb-colour-card input[type="radio"]:checked + .fb-colour-inner .fb-colour-text {
    font-weight: 700;
    color: var(--gold-primary);
}

/* Conditional Inputs */
.fb-conditional-input {
    margin-top: 14px;
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

.fb-conditional-input.is-visible {
    display: block;
}

/* Environment Cards Grid */
.fb-env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.fb-env-card {
    position: relative;
    cursor: pointer;
}

.fb-env-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.fb-env-card-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-input);
    transition: border-color 0.25s ease;
    height: 100%;
}

.fb-env-badge,
.fb-env-code {
    align-self: flex-start;
    padding: 3px 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold-primary);
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-subtle);
}

.fb-env-badge.badge-custom {
    background: var(--gold-bg-subtle);
    color: var(--gold-light);
}

.fb-env-card input[type="radio"]:checked + .fb-env-card-inner {
    border-color: var(--gold-primary);
    background-color: var(--gold-bg-subtle);
}

.fb-env-card input[type="radio"]:checked + .fb-env-card-inner .fb-env-badge,
.fb-env-card input[type="radio"]:checked + .fb-env-card-inner .fb-env-code {
    background: var(--gold-primary);
    color: var(--text-white);
}

.fb-env-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-white);
}

.fb-env-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Upload Studio Dropzone */
.fb-dropzone {
    border: 2px dashed rgba(201, 141, 95, 0.4);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    background-color: var(--bg-input);
    cursor: pointer;
    transition: border-color 0.25s ease;
    position: relative;
}

.fb-dropzone:hover,
.fb-dropzone.is-dragover {
    border-color: var(--gold-primary);
    background-color: var(--gold-bg-subtle);
}

.fb-dropzone-illustration,
.fb-dropzone-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: rgba(201, 141, 95, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gold-border);
    color: var(--gold-primary);
}

.fb-dropzone-illustration svg,
.fb-dropzone-icon svg {
    width: 30px;
    height: 30px;
}

.fb-dropzone-title,
.fb-dropzone-text {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px;
}

.fb-dropzone-sub,
.fb-dropzone-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.fb-dropzone-tag {
    display: inline-block;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--gold-primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--gold-border);
}

.fb-file-input {
    display: none;
}

/* Preview Grid */
.fb-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 18px;
    margin-top: 26px;
}

.fb-preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--gold-border);
    background-color: #000;
}

.fb-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fb-preview-remove {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(239, 68, 68, 0.92);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s ease;
}

.fb-preview-remove:hover {
    background: var(--danger);
}

.fb-preview-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(14, 15, 23, 0.95);
    color: var(--gold-primary);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--gold-border);
}

/* Floating Actions & Clean CTA Button */
.fb-floating-actions,
.fb-form-actions {
    position: sticky;
    bottom: 24px;
    z-index: 900;
    margin-top: 16px;
}

.fb-btn-submit-hero,
.fb-btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    padding: 20px 40px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-white);
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-btn);
    transition: background 0.25s ease, transform 0.25s ease;
}

.fb-btn-submit-hero:hover,
.fb-btn-submit:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 100%);
}

.fb-btn-submit-hero:disabled,
.fb-btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.fb-btn-icon svg {
    width: 24px;
    height: 24px;
}

.fb-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    display: none;
}

.fb-btn-submit-hero.is-loading .fb-spinner,
.fb-btn-submit.is-loading .fb-spinner {
    display: block;
}

.fb-btn-submit-hero.is-loading .fb-btn-icon {
    display: none;
}

/* Toast Alert Floating */
.fb-alert-toast,
.fb-alert {
    position: fixed;
    top: 85px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    min-width: 340px;
    max-width: 90%;
    padding: 18px 28px;
    border-radius: var(--radius-md);
    font-size: 1.02rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    animation: slideDownToast 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.fb-alert-success {
    background: #064e3b;
    border: 1px solid #10b981;
    color: #ffffff;
}

.fb-alert-error {
    background: #7f1d1d;
    border: 1px solid #ef4444;
    color: #ffffff;
}

.fb-footer {
    text-align: center;
    margin-top: 52px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDownToast {
    from { opacity: 0; transform: translate(-50%, -24px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .fb-navbar {
        padding: 14px 16px;
    }

    .fb-section-card,
    .fb-card {
        padding: 22px 18px;
    }
    
    .fb-style-selector,
    .fb-env-grid {
        grid-template-columns: 1fr;
    }

    .fb-btn-submit-hero,
    .fb-btn-submit {
        font-size: 1.08rem;
        padding: 16px 24px;
    }
}
