/* ============================
   المنهج الشامل - PWA Styles
   Premium Dark Theme
   ============================ */

/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0118;
    --bg-secondary: #1a0a2e;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0e6ff;
    --text-secondary: rgba(240, 230, 255, 0.7);
    --accent-purple: #9333ea;
    --accent-pink: #ec4899;
    --accent-gradient: linear-gradient(135deg, #9333ea, #ec4899);
    --accent-gradient-2: linear-gradient(135deg, #6366f1, #8b5cf6);
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-glow: 0 0 30px rgba(147, 51, 234, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-ar: 'Tajawal', 'Amiri', sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ar);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== Background Animation ===== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #9333ea44, transparent);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.bg-orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #ec489944, transparent);
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

.bg-orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #6366f144, transparent);
    top: 40%;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 30px) scale(1.02); }
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(147, 51, 234, 0.3);
    box-shadow: var(--shadow-glow);
}

/* ===== App Container ===== */
#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

/* ===== Screens ===== */
.screen {
    display: none;
    min-height: 100vh;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Header ===== */
.app-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100; /* Higher than viewer content */
    background: rgba(10, 1, 24, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-title {
    flex: 1;
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-card);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 1px solid var(--glass-border);
}

.header-btn:hover, .header-btn:active {
    background: var(--bg-card-hover);
    transform: scale(1.05);
}

.back-btn {
    font-size: 1.3rem;
}

/* ===== Screen Content ===== */
.screen-content {
    flex: 1;
    padding: 16px 16px 80px;
    overflow-y: auto;
}

/* ===== LOGIN SCREEN ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 28px;
    text-align: center;
}

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

.logo-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

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

.login-card h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-ar);
    outline: none;
    transition: var(--transition);
    direction: rtl;
}

.input-group input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.15);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    pointer-events: none;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-ar);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.3);
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(147, 51, 234, 0.4);
}

.btn-full {
    width: 100%;
}

.error-text {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 12px;
    font-weight: 500;
}

.login-footer {
    margin-top: 32px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

/* ===== MAIN GRID ===== */
.main-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 20px;
}

.main-card {
    padding: 28px 24px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.main-card:hover::before, .main-card:active::before {
    opacity: 1;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.main-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.main-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== CATEGORY GRID ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.category-card {
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: var(--transition);
    animation: slideIn 0.3s ease backwards;
}

.category-card:nth-child(1) { animation-delay: 0.05s; }
.category-card:nth-child(2) { animation-delay: 0.1s; }
.category-card:nth-child(3) { animation-delay: 0.15s; }
.category-card:nth-child(4) { animation-delay: 0.2s; }
.category-card:nth-child(5) { animation-delay: 0.25s; }
.category-card:nth-child(6) { animation-delay: 0.3s; }
.category-card:nth-child(7) { animation-delay: 0.35s; }
.category-card:nth-child(8) { animation-delay: 0.4s; }

.category-card:hover, .category-card:active {
    background: var(--bg-card-hover);
    border-color: rgba(147, 51, 234, 0.3);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.category-card h3 {
    font-size: 0.9rem;
    font-weight: 700;
}

.category-card p {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== LESSONS LIST ===== */
.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    animation: slideIn 0.3s ease backwards;
}

.lesson-card:hover, .lesson-card:active {
    background: var(--bg-card-hover);
    border-color: rgba(147, 51, 234, 0.3);
    transform: translateX(4px);
}

.lesson-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.lesson-title {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
}

.lesson-arrow {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.lesson-card.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.lesson-card.disabled .lesson-title::after {
    content: ' (قريباً)';
    color: var(--warning);
    font-size: 0.75rem;
}

/* ===== Years row for models ===== */
.years-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.year-btn {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    text-align: center;
    min-width: 70px;
}

.year-btn:hover, .year-btn:active {
    background: var(--accent-gradient);
    border-color: transparent;
    transform: translateY(-2px);
}

/* ===== Subject section label ===== */
.subject-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
    padding-right: 4px;
}

/* ===== IMAGE VIEWER ===== */
.viewer-header {
    background: rgba(0, 0, 0, 0.9);
}

.image-counter {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.viewer-container {
    flex: 1;
    overflow: auto;
    background: #000;
    position: relative;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.zoom-content {
    width: 100%;
    min-height: 100%;
    transform-origin: 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    will-change: transform;
    cursor: grab;
}

.zoom-content:active {
    cursor: grabbing;
}

.viewer-container .img-loading {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    overflow: hidden;
}

.viewer-container img {
    width: 100%;
    border-radius: 4px;
    display: block;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

/* ===== Watermark ===== */
.watermark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
    display: none;
}

.watermark-overlay.active {
    display: block;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 120px,
        rgba(255, 255, 255, 0.02) 120px,
        rgba(255, 255, 255, 0.02) 121px
    );
}

.watermark-text {
    position: absolute;
    color: rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    font-weight: 700;
    transform: rotate(-35deg);
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 1px;
}

/* ===== COMING SOON ===== */
.coming-soon {
    text-align: center;
    padding: 60px 24px;
    margin-top: 40px;
}

.coming-soon-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.coming-soon h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

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

/* ===== CHATBOT FAB ===== */
.chat-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 25px rgba(147, 51, 234, 0.4);
    z-index: 200;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fabPulse 3s ease-in-out infinite;
}

@keyframes fabPulse {
    0%, 100% { box-shadow: 0 4px 25px rgba(147, 51, 234, 0.4); }
    50% { box-shadow: 0 4px 40px rgba(147, 51, 234, 0.6); }
}

.chat-fab:hover {
    transform: scale(1.1);
}

.fab-icon {
    line-height: 1;
}

/* ===== CHATBOT WINDOW ===== */
.chat-window {
    position: fixed;
    bottom: 96px;
    left: 16px;
    width: calc(100% - 32px);
    max-width: 400px;
    height: 450px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    z-index: 25;
    display: flex;
    flex-direction: column;
    background: rgba(10, 1, 24, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: chatOpen 0.3s ease;
}

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

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    font-size: 1.5rem;
}

.chat-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.chat-status {
    font-size: 0.7rem;
    color: var(--success);
}

.chat-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.chat-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

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

.chat-message {
    max-width: 85%;
    animation: msgIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
}

.chat-message.bot {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.6;
    direction: rtl;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border-bottom-left: 4px;
}

.chat-message.bot .message-bubble {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-bottom-right: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Input */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 0.88rem;
    outline: none;
    direction: rtl;
    transition: var(--transition);
}

.chat-input-area input:focus {
    border-color: var(--accent-purple);
}

.chat-input-area input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.08);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(147, 51, 234, 0.3);
    border-radius: 4px;
}

/* ===== Media Queries ===== */
@media (min-width: 768px) {
    #app {
        border-left: 1px solid var(--glass-border);
        border-right: 1px solid var(--glass-border);
    }
}

@media (max-width: 360px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .login-card h1 {
        font-size: 1.6rem;
    }
}

/* ===== iOS specific fixes ===== */
@supports (-webkit-touch-callout: none) {
    .screen-content {
        padding-bottom: 100px;
    }
    
    .chat-fab {
        bottom: 32px;
    }
}

/* ===== Models Detail Screen ===== */
.subject-label {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-light);
    margin: 1.5rem 0 0.8rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    padding-right: 1.2rem;
}

.subject-label::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 18px;
    background: linear-gradient(to bottom, var(--primary-light), var(--primary-main));
    border-radius: 3px;
}

.years-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.year-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.year-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.year-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.2);
}

/* ===== iOS Install Banner ===== */
.ios-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 16px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ios-banner-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 20px;
    text-align: center;
    position: relative;
    background: rgba(26, 10, 46, 0.95) !important;
    border: 1px solid rgba(147, 51, 234, 0.3) !important;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
}

.ios-banner-close {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.ios-banner-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.ios-banner-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.ios-banner-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ios-banner-content > p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.ios-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: right;
}

.ios-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.ios-step .step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.share-icon {
    display: inline;
}

/* ===== ENHANCED CHAT INPUT (CAPTURE) ===== */
.chat-input-area {
    display: flex;
    padding: 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--glass-border);
    gap: 8px;
    align-items: center;
}

.chat-input-area input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 20px;
    font-family: 'Tajawal', sans-serif;
    outline: none;
    transition: var(--transition);
}

.chat-capture-btn, .chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-capture-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.chat-capture-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-send-btn {
    background: var(--accent-gradient);
    color: white;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== ATTACHMENT PREVIEW ===== */
.chat-attachment-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.chat-attachment-preview.hidden {
    display: none;
}

.chat-attachment-preview img {
    height: 48px;
    max-width: 100px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    border: 1px solid var(--accent-purple);
    background: rgba(255, 255, 255, 0.05);
}

#chat-attachment-remove {
    background: rgba(255, 0, 0, 0.2);
    color: #ff4d4d;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

#chat-attachment-remove:hover {
    background: rgba(255, 0, 0, 0.4);
}

/* ===== CAPTURE OVERLAY & SELECTION ===== */
.capture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    cursor: crosshair;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.selection-box {
    position: absolute;
    border: 2px dashed #00ff88;
    background: rgba(0, 255, 136, 0.2);
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); /* Dim the rest of screen */
}

.capture-controls {
    position: absolute;
    bottom: 30px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 12px;
    text-align: center;
    pointer-events: auto; /* allow clicking cancel */
}

.capture-controls p {
    color: white;
    margin-bottom: 10px;
}

/* Image preview in chat */
.chat-img-preview {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
