/* Riyadh & Jeddah Stories Theme - Premium CSS */

:root {
    --bg-dark: #09090b;
    --card-bg: #18181b;
    --accent: #d97706; /* Amber color */
    --accent-hover: #b45309;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --glass-bg: rgba(24, 24, 27, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Cairo', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    direction: rtl; /* Arabic support */
}

/* Background Ambient Glow */
.ambient-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.08) 0%, rgba(9, 9, 11, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

/* Device Shell on Desktop */
.app-container {
    width: 100%;
    height: 100vh;
    max-width: 450px;
    background-color: #000;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 480px) {
    .app-container {
        height: 85vh;
        max-height: 850px;
        border-radius: 32px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 12px #27272a;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Categories List */
.categories-bar {
    display: flex;
    gap: 12px;
    padding: 16px 12px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: auto;
}

.categories-bar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.category-item:active {
    transform: scale(0.92);
}

.category-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #27272a;
    transition: all 0.3s ease;
}

.category-item.active .category-ring {
    background: linear-gradient(45deg, #d97706, #f59e0b, #3b82f6);
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.4);
}

.category-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #1c1917;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    overflow: hidden;
}

.category-name {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 65px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.category-item.active .category-name {
    color: #fff;
    font-weight: 700;
}

/* Stories Section */
.story-wrapper {
    flex: 1;
    position: relative;
    background-color: #111;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Background Media */
.story-media-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
}

.story-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

/* Story Overlays */
.story-top-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 160px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 4;
    pointer-events: none;
}

.story-bottom-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 220px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 40%, rgba(0, 0, 0, 0) 100%);
    z-index: 4;
    pointer-events: none;
}

/* Progress Indicators */
.progress-container {
    position: absolute;
    top: 88px; /* Below the categories bar */
    left: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.progress-track {
    flex: 1;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #fff;
    border-radius: 2px;
}

.progress-fill.filled {
    width: 100%;
}

.progress-fill.active {
    width: 0%;
    transition: width 5s linear;
}

.progress-fill.paused {
    transition: none !important;
}

/* Tap Areas for Navigation */
.nav-tap-area {
    position: absolute;
    top: 150px;
    bottom: 120px;
    width: 50%;
    z-index: 5;
    cursor: pointer;
}

.nav-tap-left {
    right: 0; /* Since RTL, right is forward/next */
}

.nav-tap-right {
    left: 0; /* Left is backward/prev */
}

/* Merchant Info & Badge */
.story-info-card {
    position: absolute;
    bottom: 84px;
    left: 16px;
    right: 16px;
    z-index: 6;
    pointer-events: auto;
}

.merchant-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.merchant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 14px;
}

.merchant-meta {
    display: flex;
    flex-direction: column;
}

.merchant-name {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.ad-reference {
    font-size: 10px;
    color: var(--text-secondary);
}

.story-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.story-description {
    font-size: 13px;
    color: #e4e4e7;
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Price Tags */
.price-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.price-after {
    font-size: 18px;
    font-weight: 800;
    color: #f59e0b; /* Golden accent */
}

.price-before {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.discount-tag {
    background-color: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    animation: pulse 2s infinite;
}

/* CTA Action Button */
.cta-container {
    position: absolute;
    bottom: 20px;
    left: 16px;
    right: 16px;
    z-index: 6;
    pointer-events: auto;
}

.cta-button {
    width: 100%;
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cta-button:active {
    transform: scale(0.98);
    background-color: var(--accent-hover);
}

/* Slide-up Lead Drawer */
.lead-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lead-drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.lead-drawer {
    position: absolute;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px 32px 20px;
    z-index: 21;
    transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.lead-drawer-overlay.open .lead-drawer {
    bottom: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.drawer-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.drawer-close {
    background: rgba(255,255,255,0.08);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.form-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 14px;
    color: #fff;
    font-size: 14px;
    text-align: right;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.submit-btn {
    width: 100%;
    background-color: #2563eb; /* Blue button */
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.submit-btn:active {
    transform: scale(0.98);
    background-color: #1d4ed8;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Audio Player styling or Audio static state indicator */
.audio-indicator {
    position: absolute;
    top: 100px;
    left: 20px;
    background: rgba(0,0,0,0.6);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
}

.audio-bars {
    display: flex;
    gap: 2px;
    height: 10px;
    align-items: flex-end;
}

.audio-bar {
    width: 2px;
    height: 100%;
    background-color: var(--accent);
    animation: bounce 1s ease-in-out infinite alternate;
}

.audio-bar:nth-child(2) { animation-delay: 0.2s; }
.audio-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0% { height: 2px; }
    100% { height: 100%; }
}
