/* 
 * Quran E'arab & Sarf - Shared Styles
 * Theme: Islamic Modern (Emerald Green & Gold)
 */

:root {
    /* Color Palette */
    --primary: #32de84;
    /* Emerald 700 */
    --primary-hover: #26c673;
    /* Emerald 600 */
    --primary-light: #D1FAE5;
    /* Emerald 100 */
    --secondary: #D97706;
    /* Amber 600 */
    --accent: #20B2AA;
    /* Emerald 500 */

    --bg-body: #fefefe;
    /* Emerald 50 */
    --bg-card: #FFFFFF;
    --bg-input: #FAFAFA;

    --text-main: #1F2937;
    /* Gray 800 */
    --text-muted: #6B7280;
    /* Gray 500 */
    --text-light: #9CA3AF;
    /* Gray 400 */

    --border-color: #E5E7EB;
    /* Gray 200 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Typography */
    --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-arabic: 'Amiri', 'Traditional Arabic', serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 12px 80px 12px;
    /* Increased top, reduced sides */
    flex: 1;
    /* Space for bottom nav on mobile */
}

@media (min-width: 769px) {
    .app-container {
        padding-top: 40px;
        padding-bottom: 40px;
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    line-height: 1.3;
    font-weight: 700;
}

h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
}

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

a:hover {
    color: var(--primary-hover);
}

/* Components */

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 6px -1px rgba(4, 120, 87, 0.2);
}

.btn-primary:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: var(--text-light);
}

/* Navigation */
/* Desktop Top Nav */
.top-nav {
    background: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    display: none;
    /* Hidden on mobile by default */
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-item {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

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

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

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary);
    border-radius: 2px;
}

/* Mobile Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border-color);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 0.25rem;
}

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

.bottom-nav-icon {
    font-size: 1.5rem;
}

/* Responsive Visibility */
@media (min-width: 769px) {
    .top-nav {
        display: block;
    }

    .bottom-nav {
        display: none;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

.hidden {
    display: none !important;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-body);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Specific App Styles */
.arabic-text {
    font-family: var(--font-arabic);
    direction: rtl;
}

.result-card {
    border-left: 4px solid var(--primary);
}

.translation-box {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--secondary);
    margin-bottom: 1rem;
}

.translation-label {
    color: var(--secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* Animation */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* E'arab Content Normalization */
#earabContent {
    font-family: var(--font-arabic);
    line-height: 1.8;
}

#earabContent h1,
#earabContent h2,
#earabContent h3,
#earabContent .card-header,
#earabContent .card-header * {
    font-size: 1.25rem !important;
    /* Slightly reduced from 1.5rem */
    margin-bottom: 0.5rem;
    font-weight: 500 !important;
    /* Reduced to 500 and forced */
    color: var(--primary);
}

#earabContent p,
#earabContent div,
#earabContent span {
    font-size: 1.125rem !important;
    /* 18px */
}

/* Preserve source colors but ensure readability */
#earabContent * {
    line-height: 1.8 !important;
}