/**
 * TASHRIF AI - KITAB KUNING THEME
 * Warna latar kitab kuning + hijau sage kuat (vintage app style)
 */

/* ========================================
   CSS VARIABLES - KITAB KUNING THEME
======================================== */
:root {
    /* Primary Colors - Sage Green (KUAT, tidak warm) */
    --primary: #2D5F3F;
    --primary-dark: #1B4332;
    --primary-light: #3A7D4A;
    --secondary: #52B788;
    --accent: #74C69D;
    
    /* Status Colors (Saturated, vintage style) */
    --success: #2D6A4F;
    --warning: #D4A574;
    --error: #B85042;
    --info: #3D5A80;
    
    /* Background - Kitab Kuning Colors */
    --bg: #FFF9E6;              /* Cream paper - main background */
    --bg-secondary: #F5EFE0;    /* Darker cream */
    --surface: #FFFBF0;         /* White-cream surface */
    --border: #D4C5A9;          /* Aged paper border */
    --border-strong: #B8A888;   /* Stronger border */
    
    /* Text Colors (High contrast) */
    --text: #1A1A1A;            /* Almost black */
    --text-secondary: #3D3D3D;  /* Dark gray */
    --text-muted: #6B6B6B;      /* Medium gray */
    
    /* Shadows (More defined for vintage look) */
    --shadow-sm: 0 2px 4px 0 rgba(45, 95, 63, 0.1);
    --shadow: 0 2px 6px 0 rgba(45, 95, 63, 0.15);
    --shadow-md: 0 4px 12px 0 rgba(45, 95, 63, 0.2);
    --shadow-lg: 0 8px 20px 0 rgba(45, 95, 63, 0.25);
    --shadow-xl: 0 12px 30px 0 rgba(45, 95, 63, 0.3);
    
    /* Spacing */
    --nav-height: 64px;
    --input-height: 72px;
    
    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Amiri', serif;
    
    /* Transitions */
    --transition: all 0.2s ease;
}

/* ========================================
   RESET & BASE
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    /* Texture kitab kuning (subtle) */
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(212, 197, 169, 0.03) 2px,
            rgba(212, 197, 169, 0.03) 4px
        );
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input {
    font-family: inherit;
}

/* ========================================
   SPLASH SCREEN - KITAB KUNING THEME
======================================== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #2D5F3F 0%, #1B4332 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.splash-screen.hidden {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

/* Animated particles */
.splash-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 249, 230, 0.7);
    border-radius: 50%;
    animation: particleFloat 8s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 6s; }
.particle:nth-child(2) { left: 80%; top: 40%; animation-delay: 1s; animation-duration: 8s; }
.particle:nth-child(3) { left: 30%; top: 70%; animation-delay: 2s; animation-duration: 7s; }
.particle:nth-child(4) { left: 60%; top: 15%; animation-delay: 1.5s; animation-duration: 9s; }
.particle:nth-child(5) { left: 90%; top: 80%; animation-delay: 0.5s; animation-duration: 7.5s; }

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% { opacity: 0.7; }
    50% {
        transform: translateY(-100px) translateX(50px) scale(1.5);
        opacity: 0.9;
    }
    90% { opacity: 0.5; }
}

/* Glowing orbs */
.splash-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: orbFloat 6s infinite ease-in-out;
}

.splash-orb-1 {
    width: 300px;
    height: 300px;
    background: #52B788;
    top: -100px;
    left: -100px;
}

.splash-orb-2 {
    width: 250px;
    height: 250px;
    background: #74C69D;
    bottom: -80px;
    right: -80px;
    animation-delay: 2s;
}

.splash-orb-3 {
    width: 200px;
    height: 200px;
    background: #D4A574;
    top: 50%;
    left: 50%;
    animation-delay: 4s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, -30px) scale(1.1);
    }
}

/* Main content */
.splash-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

/* Logo with rings */
.splash-logo-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 2rem;
}

/* ========================================
   SPLASH SCREEN - LOGO CIRCULAR
======================================== */
.splash-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 249, 230, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%; /* ← INI YANG BIKIN BULAT */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 249, 230, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
    overflow: hidden; /* ← PENTING: Crop image jadi bulat */
}

/* Logo Image - Auto circular */
.splash-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ← GANTI dari contain ke cover */
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

/* Logo Icon */
.splash-logo-icon {
    font-size: 2.5rem;
    color: #FFF9E6;
    animation: iconPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Logo Emoji */
.splash-logo-emoji {
    font-size: 2.5rem;
    line-height: 1;
}

.splash-logo-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(255, 249, 230, 0.4);
    border-radius: 50%;
    animation: ringRotate 8s linear infinite;
}

.splash-logo-ring-2 {
    animation-duration: 12s;
    animation-direction: reverse;
    border-style: dashed;
    border-width: 2px;
}

@keyframes logoFloat {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-10px); }
}

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

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animated title */
.splash-title {
    font-family: var(--font-sans);
    font-size: 3rem;
    font-weight: 700;
    color: #FFF9E6;
    margin: 0 0 1rem;
    display: flex;
    justify-content: center;
    gap: 0.1em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.splash-char {
    display: inline-block;
    animation: charBounce 1s ease-out forwards;
    animation-delay: calc(0.5s + var(--i) * 0.1s);
    opacity: 0;
    transform: translateY(30px);
}

@keyframes charBounce {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subtitle */
.splash-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 249, 230, 0.95);
    margin: 0 0 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.splash-subtitle-line {
    display: block;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.splash-subtitle-line:nth-child(1) { animation-delay: 1.5s; }
.splash-subtitle-line:nth-child(2) { animation-delay: 1.7s; }

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

/* Progress bar */
.splash-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 249, 230, 0.25);
    border-radius: 2px;
    margin: 0 auto 1rem;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 2s forwards;
    border: 1px solid rgba(255, 249, 230, 0.3);
}

.splash-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #D4A574, #52B788, #D4A574);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: progressLoad 2s ease-out forwards,
               progressShine 1.5s linear infinite;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes progressLoad {
    from { width: 0%; }
    to { width: 100%; }
}

@keyframes progressShine {
    to { background-position: 200% 0; }
}

/* Status text */
.splash-status {
    font-size: 0.9rem;
    color: rgba(255, 249, 230, 0.85);
    opacity: 0;
    animation: fadeIn 0.5s ease-out 2.2s forwards;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Decorative Arabic text */
.splash-decoration {
    position: absolute;
    font-family: var(--font-arabic);
    font-size: 1.5rem;
    color: rgba(255, 249, 230, 0.2);
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.splash-deco-top {
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: decoFloat 4s ease-in-out infinite;
}

.splash-deco-bottom {
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: decoFloat 4s ease-in-out infinite 2s;
}

@keyframes decoFloat {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 0.2;
    }
    50% {
        transform: translateX(-50%) translateY(-10px);
        opacity: 0.3;
    }
}

/* ========================================
   NAVIGATION
======================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--surface);
    border-bottom: 3px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ========================================
   NAVIGATION - LOGO CIRCULAR
======================================== */
.nav-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%; /* ← INI YANG BIKIN BULAT */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 1.5rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary-dark);
    overflow: hidden; /* ← PENTING: Crop image jadi bulat */
    flex-shrink: 0;
}

/* Logo Image - Auto circular */
.nav-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ← GANTI dari contain ke cover */
    display: block;
}

/* Logo Emoji */
.nav-logo-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.nav-brand {
    display: flex;
    flex-direction: column;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
}

.nav-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--bg);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary-dark);
    letter-spacing: 0.5px;
}

.nav-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 2px solid var(--border);
    font-size: 1.1rem;
}

.nav-btn:hover {
    background: var(--primary);
    color: var(--bg);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   CHAT AREA
======================================== */
.chat {
    position: relative;
    padding-top: calc(var(--nav-height) + 2rem);
    padding-bottom: calc(var(--input-height) + 2rem);
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Watermark background - Kitab Kuning Style */
.chat::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vmin;
    height: 60vmin;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">📖</text></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    filter: sepia(0.3) hue-rotate(20deg);
    animation: watermarkPulse 8s ease-in-out infinite;
}

@keyframes watermarkPulse {
    0%, 100% {
        opacity: 0.04;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.06;
        transform: translate(-50%, -50%) scale(1.02);
    }
}

.chat > * {
    position: relative;
    z-index: 1;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    padding: 4rem 1rem;
}

/* ========================================
   WELCOME MESSAGE - ICON CIRCULAR
======================================== */
.welcome-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%; /* ← INI YANG BIKIN BULAT */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 3rem;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--primary-dark);
    overflow: hidden; /* ← PENTING: Crop image jadi bulat */
}

/* Welcome Icon Image - Auto circular */
.welcome-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ← GANTI dari contain ke cover */
    display: block;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    text-shadow: 1px 1px 0 rgba(212, 197, 169, 0.3);
}

.welcome-desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

.welcome-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.welcome-example-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.welcome-example {
    padding: 0.875rem 1.75rem;
    background: var(--surface);
    border: 3px solid var(--border-strong);
    border-radius: 10px;
    font-family: var(--font-arabic);
    font-size: 1.5rem;
    color: var(--primary-dark);
    transition: var(--transition);
    box-shadow: var(--shadow);
    font-weight: 600;
}

.welcome-example:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--bg);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Messages */
.message {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.message-user {
    justify-content: flex-end;
}

.bubble-user,
.bubble-ai {
    max-width: 80%;
    padding: 1.125rem 1.5rem;
    border-radius: 14px;
    line-height: 1.5;
    box-shadow: var(--shadow);
}

.bubble-user {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--bg);
    border-bottom-right-radius: 4px;
    font-family: var(--font-arabic);
    font-size: 1.375rem;
    border: 2px solid var(--primary-dark);
    font-weight: 600;
}

.bubble-ai {
    background: var(--surface);
    border: 3px solid var(--border-strong);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-md);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 3px solid var(--border-strong);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    max-width: 200px;
    box-shadow: var(--shadow);
}

.typing-dot {
    width: 9px;
    height: 9px;
    background: var(--primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.typing-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Result card */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--border-strong);
}

.result-info {
    flex: 1;
}

.result-bab {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-meaning {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.result-root {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    letter-spacing: 1px;
}

.result-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    border: 2px solid;
    letter-spacing: 0.3px;
}

.tag-success {
    background: #B7E4C7;
    color: #1B4332;
    border-color: #2D6A4F;
}

.tag-warning {
    background: #F4E4D4;
    color: #6B4423;
    border-color: #8B5A2B;
}

.tag-info {
    background: #D4E4F4;
    color: #1E3A5F;
    border-color: #3D5A80;
}

.result-arabic {
    font-family: var(--font-arabic);
    font-size: 3rem;
    color: var(--primary-dark);
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(212, 197, 169, 0.3);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border: 3px solid var(--border-strong);
    border-radius: 10px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: var(--shadow);
    letter-spacing: 0.3px;
}

.action-btn:hover {
    background: var(--primary);
    color: var(--bg);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn.copied {
    background: var(--success);
    color: var(--bg);
    border-color: #1B4332;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid var(--border-strong);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 700;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

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

.tab-btn.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
    background: var(--bg-secondary);
}

.tab-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid;
}

.badge-blue {
    background: #D4E4F4;
    color: #1E3A5F;
    border-color: #3D5A80;
}

.badge-green {
    background: #B7E4C7;
    color: #1B4332;
    border-color: #2D6A4F;
}

.badge-red {
    background: #F4D4D4;
    color: #6B2323;
    border-color: #8B3A3A;
}

/* Istilahi grid */
.istilahi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.istilahi-card {
    padding: 1.25rem;
    background: var(--surface);
    border: 3px solid var(--border-strong);
    border-radius: 12px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.istilahi-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--primary);
}

.istilahi-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.istilahi-arabic {
    font-family: var(--font-arabic);
    font-size: 1.75rem;
    color: var(--primary-dark);
    margin-bottom: 0.625rem;
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(212, 197, 169, 0.2);
}

.istilahi-meaning {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 0.625rem;
    font-weight: 600;
}

.istilahi-wazan {
    font-family: var(--font-arabic);
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Lughawi */
.lughawi-section {
    margin-bottom: 2rem;
}

.lughawi-section-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 3px solid var(--border-strong);
    letter-spacing: 0.3px;
}

.lughawi-cards {
    display: grid;
    gap: 0.875rem;
}

.lughawi-card {
    display: grid;
    grid-template-columns: 90px 1fr 1fr;
    gap: 1rem;
    padding: 1.125rem;
    background: var(--surface);
    border: 3px solid var(--border-strong);
    border-radius: 10px;
    align-items: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.lughawi-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.lughawi-dhamir {
    font-family: var(--font-arabic);
    font-size: 1.375rem;
    color: var(--primary-dark);
    font-weight: 700;
    text-align: center;
}

.lughawi-dhamir-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.lughawi-fiil {
    font-family: var(--font-arabic);
    font-size: 1.25rem;
    color: var(--text);
    font-weight: 700;
}

.lughawi-arti {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Lazy placeholder */
.lazy-placeholder {
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: var(--bg-secondary);
    border: 3px dashed var(--border-strong);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.lazy-placeholder:hover {
    border-color: var(--primary);
    background: var(--surface);
    border-style: solid;
}

.lazy-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 1.75rem;
    box-shadow: var(--shadow-md);
    border: 3px solid var(--primary-dark);
}

.lazy-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.625rem;
}

.lazy-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-weight: 600;
}

.lazy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--bg);
    border-radius: 10px;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--primary-dark);
    letter-spacing: 0.3px;
}

.lazy-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Loading state */
.loading-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
}

.spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.5rem;
    border: 5px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.625rem;
}

.loading-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.progress-bar {
    width: 220px;
    height: 5px;
    margin: 0 auto;
    background: var(--border-strong);
    border-radius: 3px;
    overflow: hidden;
    border: 2px solid var(--border-strong);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    animation: progressIndeterminate 1.3s ease-in-out infinite;
}

@keyframes progressIndeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Error state */
.error-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #FEF5F5;
    border: 3px solid #D4A5A5;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: #F4D4D4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
    font-size: 1.75rem;
    border: 3px solid var(--error);
}

.error-message {
    font-size: 0.9375rem;
    color: #6B2323;
    margin-bottom: 1rem;
    font-weight: 600;
}

.error-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--error);
    color: var(--bg);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition);
    border: 2px solid #8B3A3A;
    box-shadow: var(--shadow);
    letter-spacing: 0.3px;
}

.error-btn:hover {
    background: #8B3A3A;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   INPUT AREA
======================================== */
.input-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 3px solid var(--border-strong);
    padding: 1rem;
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(45, 95, 63, 0.1);
}

.input-row {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 0.75rem;
}

.input-field {
    flex: 1;
    padding: 1.125rem 1.5rem;
    background: var(--bg);
    border: 3px solid var(--border-strong);
    border-radius: 12px;
    font-size: 1.05rem;
    color: var(--text);
    transition: var(--transition);
    font-weight: 500;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(45, 95, 63, 0.1);
}

.input-field::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.send-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--bg);
    border-radius: 12px;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--primary-dark);
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

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

/* ========================================
   HISTORY SIDEBAR
======================================== */
.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 67, 50, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.history-overlay.open {
    opacity: 1;
    visibility: visible;
}

.history-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    box-shadow: -4px 0 20px rgba(45, 95, 63, 0.2);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 3px solid var(--border-strong);
}

.history-sidebar.open {
    transform: translateX(0);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 3px solid var(--border-strong);
    background: var(--bg-secondary);
}

.history-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 0.3px;
}

.history-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 2px solid var(--border);
}

.history-close:hover {
    background: var(--error);
    color: var(--bg);
    border-color: #8B3A3A;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg);
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem;
    background: var(--surface);
    border: 3px solid var(--border-strong);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.history-item:hover {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-md);
    transform: translateX(-5px);
    border-color: var(--primary);
}

.history-item-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    flex-shrink: 0;
    border: 2px solid var(--primary-dark);
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-query {
    font-family: var(--font-arabic);
    font-size: 1.25rem;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-item-delete {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    border: 2px solid transparent;
}

.history-item-delete:hover {
    background: var(--error);
    color: var(--bg);
    border-color: #8B3A3A;
}

.history-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.history-empty-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.75rem;
    border: 3px solid var(--border);
}

.history-empty-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.history-footer {
    padding: 1rem 1.5rem;
    border-top: 3px solid var(--border-strong);
    background: var(--bg-secondary);
}

.btn-clear-history {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem;
    background: transparent;
    border: 3px solid var(--error);
    border-radius: 10px;
    color: var(--error);
    font-weight: 700;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.btn-clear-history:hover {
    background: var(--error);
    color: var(--bg);
}

/* ========================================
   TOAST
======================================== */
.toast {
    position: fixed;
    bottom: calc(var(--input-height) + 2rem);
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.75rem;
    background: var(--primary-dark);
    color: var(--bg);
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 700;
    box-shadow: var(--shadow-xl);
    z-index: 999;
    animation: toastSlide 0.3s ease;
    border: 2px solid var(--primary);
    letter-spacing: 0.3px;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========================================
   LOGO IMAGE STYLES
======================================== */

/* Navbar Logo Image */
.nav-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Splash Logo Image */
.splash-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

/* Welcome Icon Image */
.welcome-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Logo Emoji Style (jika pakai emoji) */
.splash-logo-emoji,
.nav-logo-emoji {
    font-size: 2.5rem;
    line-height: 1;
    display: block;
}

.nav-logo-emoji {
    font-size: 1.5rem;
}

/* Fallback for broken images */
.nav-logo img[src=""],
.splash-logo img[src=""],
.welcome-icon img[src=""] {
    display: none;
}

/* Loading state for images */
.nav-logo-img,
.splash-logo-img,
.welcome-icon-img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-logo-img:not([src=""]),
.splash-logo-img:not([src=""]),
.welcome-icon-img:not([src=""]) {
    opacity: 1;
}

/* Error state - hide broken images gracefully */
img.error {
    display: none;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 768px) {
    .splash-title {
        font-size: 2.25rem;
    }
    
    .splash-subtitle {
        font-size: 1rem;
    }
    
    .splash-logo-wrapper {
        width: 110px;
        height: 110px;
    }
    
    .splash-logo {
        width: 70px;
        height: 70px;
    }
    
    .splash-logo-icon {
        font-size: 2.25rem;
    }
    
    .nav {
        padding: 0 1rem;
    }
    
    .nav-title {
        font-size: 1.125rem;
    }
    
    .nav-subtitle {
        font-size: 0.7rem;
    }
    
    .nav-badge {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .result-arabic {
        font-size: 2.25rem;
    }
    
    .istilahi-grid {
        grid-template-columns: 1fr;
    }
    
    .lughawi-card {
        grid-template-columns: 1fr;
        gap: 0.625rem;
        text-align: center;
    }
    
    .lughawi-dhamir,
    .lughawi-fiil,
    .lughawi-arti {
        text-align: center;
    }
    
    .history-sidebar {
        max-width: 100%;
    }
    
    .welcome-examples {
        flex-direction: column;
    }
    
    .welcome-example {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .tabs {
        gap: 0.25rem;
    }
    
    .tab-btn {
        padding: 0.75rem 0.875rem;
        font-size: 0.8rem;
    }
    
    .input-field {
        font-size: 1rem;
        padding: 1rem 1.25rem;
    }
    
    .send-btn {
        padding: 0 1.25rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .nav,
    .input-wrapper,
    .history-sidebar,
    .action-buttons,
    .splash-screen {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .chat {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}
