/* 
  Sahilah Style (سهّلها)
  Premium Mobile-First Styling
  Designed for RTL (Arabic) & High Visual Excellence
*/

:root {
    --bg-primary: #12131e;
    --bg-secondary: #1a1c29;
    --bg-tertiary: #23273a;
    --bg-card: rgba(35, 39, 58, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --color-primary: #6366f1; /* Indigo */
    --color-primary-hover: #4f46e5;
    --color-accent: #10b981; /* Emerald Green */
    --color-warning: #f59e0b; /* Amber */
    --color-danger: #ef4444; /* Rose Red */
    --color-gold: linear-gradient(135deg, #fce881, #cba135);
    --color-gold-solid: #d4af37;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-white: #ffffff;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Montserrat', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #0b0c10;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

/* App Container (Smartphone Frame on Desktop, Full-Screen on Mobile) */
.app-container {
    width: 450px;
    height: 92vh;
    max-height: 850px;
    background-color: var(--bg-primary);
    border-radius: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 12px #262938;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 480px) {
    body {
        background-color: var(--bg-primary);
    }
    .app-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }
}

/* Header back-btn arrow */
.back-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-white);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-left: 10px;
}

.back-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--color-primary);
}

/* LOGIN OVERLAY SYSTEM */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(11, 12, 16, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 90%;
    max-width: 380px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 30px 24px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: loginPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-logo {
    margin-bottom: 24px;
}

.login-logo i {
    font-size: 2.5rem;
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.1);
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 12px;
    box-shadow: var(--shadow-sm);
}

.login-logo h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-white);
}

.login-logo span {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.login-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 25px;
}

/* App Header styling (Glassmorphism) */
.app-header {
    background-color: rgba(26, 28, 41, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.logo-icon i {
    color: var(--text-white);
    font-size: 1.1rem;
}

.logo-text {
    margin-right: 12px;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
}

.header-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-normal);
}

.badge-free {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-premium {
    background: var(--color-gold);
    color: #3b2a00;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
    animation: goldPulse 2s infinite alternate;
}

@keyframes goldPulse {
    0% { box-shadow: 0 2px 5px rgba(212, 175, 55, 0.2); }
    100% { box-shadow: 0 2px 15px rgba(212, 175, 55, 0.5); }
}

/* App Main Content Area */
.app-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)); /* Space for nav bar */
    scroll-behavior: smooth;
}

/* Hide scrollbar for cleaner app look */
.app-content::-webkit-scrollbar {
    width: 4px;
}
.app-content::-webkit-scrollbar-track {
    background: transparent;
}
.app-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Screens toggling */
.app-screen {
    display: none;
    padding: 20px;
    animation: fadeIn var(--transition-normal);
}

.app-screen.active {
    display: block;
}

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

/* SCREEN 1: CHAT SCREEN STYLING */
#screen-chat {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-welcome {
    padding: 30px 20px;
    text-align: center;
    flex: 1;
    overflow-y: auto;
}

.welcome-icon {
    width: 70px;
    height: 70px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    color: var(--color-primary);
    font-size: 2rem;
}

.chat-welcome h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-white);
}

.chat-welcome p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

/* Limits panel */
.limit-status-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 30px;
    text-align: right;
}

.limit-text {
    font-size: 0.85rem;
    color: var(--text-main);
    display: block;
    margin-bottom: 8px;
}

.limit-text strong {
    color: var(--color-primary);
}

.limit-bar {
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.limit-progress {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 3px;
    transition: width var(--transition-normal);
}

/* Suggestion Grid */
.suggestions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.suggest-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 12px;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.suggest-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.suggest-btn i.icon {
    font-size: 1.25rem;
    color: var(--color-primary);
}

.suggest-btn span {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 0.92rem;
    line-height: 1.6;
    position: relative;
    animation: messagePop var(--transition-normal);
}

@keyframes messagePop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.message.user {
    align-self: flex-start;
    background-color: var(--color-primary);
    color: var(--text-white);
    border-bottom-right-radius: 4px;
    text-align: right;
}

.message.assistant {
    align-self: flex-end;
    background-color: var(--bg-tertiary);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
    text-align: right;
}

/* Action icons inside assistant messages (e.g. Save, Share, Copy) */
.message-actions {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-fast);
}

.action-btn:hover {
    color: var(--color-primary);
}

.action-btn.saved i {
    color: var(--color-warning);
}

/* Chat Input Bar */
.chat-input-area {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input-area textarea {
    flex: 1;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 10px 16px;
    color: var(--text-white);
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 100px;
    transition: var(--transition-fast);
}

.chat-input-area textarea:focus {
    border-color: var(--color-primary);
}

.send-btn {
    width: 42px;
    height: 42px;
    background-color: var(--color-primary);
    color: var(--text-white);
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-fast);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.send-btn:hover {
    background-color: var(--color-primary-hover);
    transform: scale(1.05);
}

.mic-btn {
    width: 42px;
    height: 42px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.mic-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.mic-btn.listening {
    background-color: var(--color-danger);
    color: var(--text-white);
    border-color: var(--color-danger);
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Typing Indicator Animation */
.typing-indicator-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    align-self: flex-end;
    margin-right: 20px;
}

.typing-bubble {
    display: flex;
    gap: 4px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
}

.typing-bubble span {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing 1s infinite alternate;
}

.typing-bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-bubble span:nth-child(3) {
    animation-delay: 0.4s;
}

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

@keyframes typing {
    from { transform: translateY(0); opacity: 0.3; }
    to { transform: translateY(-5px); opacity: 1; }
}

/* SCREEN headers */
.screen-header {
    margin-bottom: 24px;
    text-align: right;
}

.screen-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.screen-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.icon-color {
    color: var(--color-primary);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state p {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.empty-state small {
    font-size: 0.75rem;
    line-height: 1.4;
    display: block;
}

/* SCREEN 2: SAVED LIST STYLING */
.saved-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    transition: var(--transition-fast);
}

.saved-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.saved-q {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.saved-a {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.5;
}

.saved-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

/* SCREEN 3: PREMIUM & SUPPORT STYLING */
.premium-hero {
    text-align: center;
    margin-bottom: 20px;
}

.crown-icon {
    width: 60px;
    height: 60px;
    background: var(--color-gold);
    color: #3b2a00;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 12px;
    font-size: 1.8rem;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.premium-hero h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 4px;
}

.premium-hero p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pricing-card {
    background: linear-gradient(180deg, var(--bg-tertiary), rgba(26, 28, 41, 0.9));
    border: 2px solid var(--color-gold-solid);
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.price-header {
    background: rgba(212, 175, 55, 0.05);
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.price-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e5c158;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.price-amount {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 4px;
}

.price-amount .amount {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
}

.price-amount .currency {
    font-size: 1rem;
    font-weight: 700;
    color: #e5c158;
}

.price-period {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.features-list {
    list-style: none;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.features-list li {
    font-size: 0.88rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.features-list li i {
    color: var(--color-accent);
}

/* Payment instructions */
.payment-instructions {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.payment-instructions h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-instructions p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 15px;
}

.payment-methods-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.method-row {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.method-value {
    font-size: 0.9rem;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    cursor: pointer;
    color: var(--color-primary);
    transition: var(--transition-fast);
}

.copy-btn:hover {
    color: var(--text-white);
}

/* WhatsApp activation components */
.whatsapp-activation-box {
    margin-top: 15px;
    text-align: right;
}

.activation-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.code-verification-form {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
    margin-top: 10px;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-white);
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-success {
    background-color: var(--color-accent);
    color: var(--text-white);
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--text-white);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Phone input styling */
.input-group {
    margin-bottom: 15px;
    text-align: right;
}

.input-group label {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text-white);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--color-primary);
}

/* Support and Whatsapp */
.support-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
}

.support-section h3 {
    font-size: 0.98rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-white);
}

.support-section p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 15px;
}

.whatsapp-btn {
    background-color: #25d366;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 12px 20px;
    border-radius: 12px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    transition: var(--transition-fast);
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
    border: none;
    cursor: pointer;
}

.whatsapp-btn:hover {
    background-color: #20ba5a;
    transform: scale(1.02);
}

/* SCREEN 4: ADMIN STYLING */
.admin-login {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
}

.admin-tabs {
    display: flex;
    background-color: var(--bg-secondary);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
    gap: 4px;
}

.admin-tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.admin-tab-btn.active {
    background-color: var(--bg-tertiary);
    color: var(--text-white);
    box-shadow: var(--shadow-sm);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active-tab {
    display: block;
}

.section-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 15px;
}

/* Code Generator styling admin */
.code-gen-box {
    margin-bottom: 15px;
}

.api-keys-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.api-status-log {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    margin-top: 15px;
}

.api-status-log h4 {
    font-size: 0.82rem;
    color: var(--text-white);
    margin-bottom: 8px;
}

.api-status-log ul {
    list-style: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-status-log li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.api-status-log li.active-key i {
    color: var(--color-accent);
}

.api-status-log li.empty-key i {
    color: var(--color-danger);
}

.text-success { color: var(--color-accent); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

/* BOTTOM NAVIGATION BAR */
.app-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background-color: rgba(26, 28, 41, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    flex: 1;
    height: 100%;
    transition: var(--transition-fast);
}

.nav-item i {
    font-size: 1.15rem;
}

.nav-item:hover {
    color: var(--text-white);
}

.nav-item.active {
    color: var(--color-primary);
}

/* App Credits Footer */
.app-credits {
    position: absolute;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.15);
    pointer-events: none;
    z-index: 99;
    letter-spacing: 0.5px;
}

.app-credits span {
    background-color: rgba(18, 19, 30, 0.6);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Home Mode Layout overrides for single scrollable page */
.home-layout #screen-chat {
    height: auto;
}
.home-layout .chat-welcome {
    overflow-y: visible;
    height: auto;
    flex: none;
}

/* ==========================================================
   GOLD & FIERY NAV BUTTON AND PREMIUM MODAL STYLES
   ========================================================== */

/* Special gold fiery button for navigation */
.app-nav .nav-item.special-gold-btn {
    color: #ffd700 !important; /* Gold text/icon */
    font-weight: bold;
    animation: goldGlowFire 2.5s infinite ease-in-out;
}

.app-nav .nav-item.special-gold-btn i {
    color: #ffd700 !important;
}

@keyframes goldGlowFire {
    0% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.4), 0 0 10px rgba(255, 69, 0, 0.2);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 25px rgba(255, 69, 0, 0.7), 0 0 35px rgba(255, 140, 0, 0.5);
        transform: scale(1.06);
    }
    100% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.4), 0 0 10px rgba(255, 69, 0, 0.2);
        transform: scale(1);
    }
}

/* Premium Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeInModal 0.3s ease-out;
    box-sizing: border-box;
}

.modal-card {
    background: linear-gradient(135deg, #1d1233, #0f0a1c);
    border: 2px solid #ffd700;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2), inset 0 0 15px rgba(255, 255, 255, 0.05);
    animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.modal-header {
    margin-bottom: 16px;
}

.gold-crown-icon {
    font-size: 2.8rem;
    color: #ffd700;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
    animation: crownFloat 2s infinite ease-in-out;
}

.modal-header h2 {
    margin: 8px 0 0 0;
    color: #fff;
    font-size: 1.4rem;
    font-weight: bold;
}

.modal-intro {
    color: #ccc;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.comparison-container {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comp-col {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 12px 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.comp-col.premium-col {
    background: rgba(255, 215, 0, 0.04);
    border: 1px solid rgba(255, 215, 0, 0.25);
}

.comp-col h3 {
    font-size: 0.85rem;
    margin: 0 0 10px 0;
    color: #eee;
    font-weight: bold;
}

.comp-col.premium-col h3 {
    color: #ffd700;
}

.comp-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: right;
}

.comp-col li {
    font-size: 0.72rem;
    color: #ccc;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    direction: rtl;
}

.comp-col li i {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.modal-price-box {
    background: rgba(255, 215, 0, 0.08);
    border: 1px dashed rgba(255, 215, 0, 0.4);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    direction: rtl;
    box-sizing: border-box;
}

.price-label {
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
}

.price-value {
    color: #ffd700;
    font-size: 1.15rem;
    font-weight: bold;
}

.modal-footer {
    display: flex;
    gap: 12px;
}

.btn-premium-action {
    flex: 2;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000 !important;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.35);
    transition: transform 0.2s;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-premium-action:hover {
    transform: scale(1.02);
}

.modal-footer .btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    color: #eee;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes crownFloat {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Ready-to-use Contracts Section Styles */
.contracts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
    padding-bottom: 20px;
}

.contract-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    transition: var(--transition-normal);
}

.contract-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
}

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

.contract-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
}

.badge-contract-free {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-size: 0.72rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-contract-premium {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    font-size: 0.72rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.contract-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.contract-card-action {
    margin-top: 5px;
}

.contract-modal-card {
    width: 92%;
    height: 80%;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

.contract-paper-view {
    flex: 1;
    background: #ffffff;
    color: #1c1d24;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 25px 20px;
    font-size: 0.88rem;
    line-height: 1.8;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
    user-select: text;
    -webkit-user-select: text;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-family: 'Cairo', sans-serif;
}

/* Print Styles - Formats the contract on white A4 paper when window.print() is called */
@media print {
    /* Hide everything in the body except the contract modal */
    body > :not(#contract-modal) {
        display: none !important;
    }
    
    #contract-modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }
    
    .contract-modal-card {
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .modal-body {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .contract-viewer-header, .modal-footer, .app-nav, #contract-copy-btn, #contract-close-btn, #contract-print-btn {
        display: none !important;
    }
    
    .contract-paper-view {
        border: none !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 12pt !important;
        line-height: 1.8 !important;
        overflow: visible !important;
        max-height: none !important;
        box-shadow: none !important;
        padding: 20mm !important; /* Professional standard A4 print margins */
        margin: 0 !important;
        width: 100% !important;
        text-align: justify !important;
    }
}
