/* ==============================================================================
   Unified Arabic-First RTL Theme & Typography for SaaS Portal
   Fonts: Almarai (Body/UI) & Cairo (Display/Headings)
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Almarai:wght@300;400;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* Google Material Symbols Outlined Utility */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* Local Offline-First Almarai Font Definitions */
@font-face {
    font-family: 'Almarai';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('fonts/Almarai-Light.woff2') format('woff2');
}

@font-face {
    font-family: 'Almarai';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/Almarai-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Almarai';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/Almarai-Bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Almarai';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('fonts/Almarai-ExtraBold.woff2') format('woff2');
}

/* CSS Variables / Theme Tokens */
:root {
    --bg-base: #06090e;
    --bg-surface: #0c121d;
    --bg-card: rgba(18, 27, 43, 0.7);
    --bg-card-hover: rgba(28, 41, 65, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(6, 182, 212, 0.35);
    
    --primary: #06b6d4;
    --primary-hover: #0891b2;
    --primary-glow: rgba(6, 182, 212, 0.25);
    
    --accent: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-ui: 'Almarai', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Cairo', 'Almarai', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
    --shadow-glow: 0 0 25px -5px var(--primary-glow);
    --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    font-size: 16px;
    direction: rtl;
    text-align: right;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 10% 15%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(59, 130, 246, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.04) 0px, transparent 70%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-ui);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, .font-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

p {
    color: var(--text-secondary);
}

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

a:hover {
    color: #38bdf8;
}

/* Layout Elements */
.container {
    width: 100%;
    max-width: 1140px;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* Header & Navigation */
.portal-header {
    padding-block: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    background-color: rgba(6, 9, 14, 0.7);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #06b6d4, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
    color: #ffffff;
}

.brand-text h1 {
    font-size: 1.25rem;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

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

/* Hero Section */
.hero-section {
    padding-block: 3.5rem 2rem;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    line-height: 1.25;
    margin-bottom: 0.85rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    max-width: 680px;
    margin-inline: auto;
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* Tab Navigation */
.nav-tabs {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-subtle);
    padding: 0.35rem;
    border-radius: var(--radius-full);
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-card);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.65rem 1.6rem;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.tab-btn:hover:not(.active) {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

/* Tab Content Areas */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Direct Slug Input Form */
.slug-entry-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 620px;
    margin-inline: auto;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(16px);
}

.slug-input-wrapper {
    display: flex;
    align-items: center;
    background: #090e17;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.slug-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.slug-domain-prefix {
    padding-inline: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    direction: ltr;
    user-select: none;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.02);
    border-inline-end: 1px solid var(--border-subtle);
}

.slug-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.85rem 1rem;
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 1.05rem;
    outline: none;
    direction: ltr;
    text-align: left;
}

.btn-submit {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 0.85rem 1.75rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-submit:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

/* Store Cards Grid */
.stores-section {
    margin-bottom: 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.search-box {
    position: relative;
    max-width: 320px;
    width: 100%;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.65rem 1.25rem 0.65rem 2.5rem;
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.store-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
}

.store-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tenant-color, var(--primary));
    opacity: 0.8;
    transition: var(--transition-smooth);
}

.store-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-highlight);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card), 0 8px 25px -5px rgba(6, 182, 212, 0.2);
}

.store-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.store-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tenant-color, var(--primary));
    flex-shrink: 0;
}

.store-info {
    flex: 1;
}

.store-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.store-subdomain {
    font-size: 0.82rem;
    color: var(--text-muted);
    direction: ltr;
    text-align: right;
    font-family: monospace;
}

.store-industry-pill {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    margin-bottom: 0.85rem;
}

.store-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.store-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.store-city {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-enter-store {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tenant-color, var(--primary));
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-smooth);
}

.store-card:hover .btn-enter-store {
    transform: translateX(-4px);
}

/* Alerts and Feedback */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fb7185;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

/* Footer */
.portal-footer {
    margin-top: auto;
    padding-block: 2.5rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(6, 9, 14, 0.9);
    text-align: center;
}

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

.footer-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.85rem;
    }
    
    .slug-input-wrapper {
        flex-direction: column;
    }
    
    .slug-domain-prefix {
        width: 100%;
        text-align: center;
        padding-block: 0.5rem;
    }
    
    .slug-input {
        width: 100%;
        text-align: center;
    }
    
    .btn-submit {
        width: 100%;
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .stores-grid {
        grid-template-columns: 1fr;
    }
}
