/**
 * the home - Frontend Modern Soft-White 3D Stylesheet
 * High Aesthetics, Soft on the eyes, 3D floating and tilt effects
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
    --th-bg: #f8fafc;
    --th-card-bg: #ffffff;
    --th-primary: #4338ca;
    --th-primary-light: #6366f1;
    --th-primary-subtle: #eef2ff;
    --th-accent: #0ea5e9;
    --th-emerald: #10b981;
    --th-amber: #f59e0b;
    --th-rose: #f43f5e;
    --th-text-main: #0f172a;
    --th-text-muted: #64748b;
    --th-border: #e2e8f0;
    --th-border-subtle: #f1f5f9;
    --th-shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.04);
    --th-shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    --th-shadow-lg: 0 20px 40px -10px rgba(67, 56, 202, 0.08);
    --th-shadow-3d: 0 15px 35px -5px rgba(0, 0, 0, 0.06), 0 5px 15px rgba(0, 0, 0, 0.03);
    --th-radius-sm: 12px;
    --th-radius-md: 18px;
    --th-radius-lg: 24px;
    --th-radius-xl: 32px;
}

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    background-color: var(--th-bg);
    color: var(--th-text-main);
    direction: rtl;
    text-align: right;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Navbar Styling (Floating Glassmorphism)
============================================================ */
.th-navbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--th-border-subtle);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 1040;
    transition: all 0.3s ease;
}

.th-brand {
    font-weight: 800;
    font-size: 1.55rem;
    color: var(--th-primary);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.th-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.28);
    transform: rotate(-3deg);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.th-brand:hover .th-brand-logo {
    transform: rotate(4deg) scale(1.08);
}

.th-navbar .th-nav-link {
    color: #334155 !important;
    font-weight: 700;
    padding: 0.5rem 0.9rem !important;
    border-radius: var(--th-radius-sm);
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.th-navbar .th-nav-link i {
    color: var(--th-primary);
}

.th-navbar .th-nav-link:hover, 
.th-navbar .th-nav-link.active {
    color: var(--th-primary) !important;
    background-color: var(--th-primary-subtle) !important;
}

.th-navbar .btn.th-btn-light,
.th-navbar .dropdown-toggle {
    color: #1e293b !important;
    font-weight: 700 !important;
}

.th-navbar .dropdown-toggle span {
    color: #1e293b !important;
    font-weight: 700 !important;
}

/* ============================================================
   3D Elements & Keyframe Floating Animations
============================================================ */
@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-14px) rotate(2deg);
    }
}

@keyframes floatReverse {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(12px) rotate(-2deg);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 25px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 0 45px rgba(99, 102, 241, 0.4);
    }
}

.animate-float {
    animation: floatSlow 5s ease-in-out infinite;
}

.animate-float-reverse {
    animation: floatReverse 6s ease-in-out infinite;
}

.floating-3d-scene {
    position: relative;
    perspective: 1200px;
    transform-style: preserve-3d;
}

.floating-3d-badge {
    position: absolute;
    background: #ffffff;
    border-radius: var(--th-radius-md);
    padding: 0.65rem 1.15rem;
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 0.92rem;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.floating-badge-1 {
    top: 10%;
    right: -10px;
    animation: floatSlow 4.5s ease-in-out infinite;
}

.floating-badge-2 {
    bottom: 12%;
    left: -15px;
    animation: floatReverse 5.5s ease-in-out infinite;
}

/* ============================================================
   Interactive 3D Tilt Card Styles
============================================================ */
.th-card-3d {
    background: var(--th-card-bg);
    border-radius: var(--th-radius-lg);
    border: 1px solid var(--th-border);
    box-shadow: var(--th-shadow-3d);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    transform-style: preserve-3d;
    transform: perspective(1000px);
    overflow: hidden;
    position: relative;
}

.th-card-3d::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #0ea5e9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.th-card-3d:hover {
    transform: perspective(1000px) translateY(-8px) rotateX(2deg);
    box-shadow: var(--th-shadow-lg), 0 25px 50px -12px rgba(99, 102, 241, 0.15);
    border-color: #cbd5e1;
}

.th-card-3d:hover::before {
    opacity: 1;
}

.th-3d-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--th-primary);
    box-shadow: 0 10px 20px -3px rgba(99, 102, 241, 0.12), inset 0 2px 4px #ffffff;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.th-card-3d:hover .th-3d-icon-box {
    transform: scale(1.1) translateZ(20px);
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 15px 25px -5px rgba(67, 56, 202, 0.35);
}

/* ============================================================
   Hero Section Styling
============================================================ */
.th-hero-section {
    padding: 4.5rem 0 3.5rem 0;
    position: relative;
    background: radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 20% 80%, rgba(14, 165, 233, 0.04) 0%, transparent 40%);
}

.th-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    background-color: var(--th-primary-subtle);
    color: var(--th-primary);
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.th-hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--th-text-main);
    line-height: 1.3;
    margin-bottom: 1.25rem;
    letter-spacing: -0.5px;
}

.th-hero-title span {
    background: linear-gradient(135deg, #4338ca 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.th-hero-subtitle {
    font-size: 1.15rem;
    color: var(--th-text-muted);
    margin-bottom: 2rem;
    max-width: 580px;
}

/* ============================================================
   Buttons with 3D Depth
============================================================ */
.th-btn-primary {
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--th-radius-sm);
    padding: 0.75rem 1.6rem;
    font-weight: 700;
    box-shadow: 0 10px 20px -3px rgba(79, 70, 229, 0.32);
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.th-btn-primary:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 14px 26px -3px rgba(79, 70, 229, 0.45);
}

.th-btn-primary:active {
    transform: translateY(1px);
}

.th-btn-light {
    background: #ffffff;
    color: var(--th-text-main);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    box-shadow: var(--th-shadow-sm);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.th-btn-light:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    color: var(--th-primary);
}

/* ============================================================
   Search Box Hero (Smooth White with Dropdown)
============================================================ */
.th-search-hero {
    background: #ffffff;
    border-radius: var(--th-radius-lg);
    padding: 0.5rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--th-border);
    display: flex;
    align-items: center;
    position: relative;
    max-width: 620px;
}

.th-search-hero input {
    border: none;
    outline: none;
    padding: 0.75rem 1.25rem;
    font-size: 1.05rem;
    width: 100%;
    color: var(--th-text-main);
    background: transparent;
    font-family: inherit;
}

.th-search-suggestions {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: #ffffff;
    border-radius: var(--th-radius-md);
    margin-top: 0.65rem;
    box-shadow: 0 20px 45px -5px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--th-border);
    max-height: 380px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

/* ============================================================
   Statistics Counters
============================================================ */
.th-stat-card {
    background: #ffffff;
    border-radius: var(--th-radius-lg);
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--th-border);
    box-shadow: var(--th-shadow-sm);
    text-align: center;
    transition: all 0.3s ease;
}

.th-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--th-shadow-md);
    border-color: #cbd5e1;
}

.th-stat-number {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--th-primary);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.th-stat-label {
    font-weight: 600;
    color: var(--th-text-muted);
    font-size: 0.95rem;
}

/* ============================================================
   Badges and Tags
============================================================ */
.th-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.th-badge-primary { background: #eef2ff; color: #4338ca; }
.th-badge-success { background: #ecfdf5; color: #059669; }
.th-badge-warning { background: #fffbeb; color: #d97706; }
.th-badge-danger { background: #fff1f2; color: #e11d48; }
.th-badge-info { background: #f0f9ff; color: #0284c7; }

/* ============================================================
   Footer Styling
============================================================ */
.th-footer {
    background: #ffffff;
    border-top: 1px solid var(--th-border);
    padding: 4rem 0 2rem 0;
    margin-top: 5rem;
}

.th-footer-title {
    font-weight: 800;
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    color: var(--th-text-main);
}

.th-footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.th-footer-links li {
    margin-bottom: 0.65rem;
}

.th-footer-links a {
    color: var(--th-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.th-footer-links a:hover {
    color: var(--th-primary);
}

/* ============================================================
   Comprehensive Mobile & Tablet Responsiveness (All Phone Sizes)
============================================================ */

/* Global Mobile Guard */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

@media (max-width: 991.98px) {
    .th-hero-title {
        font-size: 2.15rem;
    }
    .floating-3d-scene {
        margin-top: 2.5rem;
    }
    .th-card-3d {
        margin-bottom: 1rem;
    }
}

@media (max-width: 767.98px) {
    /* Navbar & Header on Mobile */
    .th-navbar {
        padding: 0.65rem 0;
    }
    .th-brand {
        font-size: 1.25rem;
        gap: 0.5rem;
    }
    .th-brand-logo {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        border-radius: 10px;
    }
    .th-navbar .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.84rem;
    }

    /* Container Spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Hero Section */
    .th-hero {
        padding: 2.5rem 0 3rem;
    }
    .th-hero-title {
        font-size: 1.85rem;
        line-height: 1.35;
        margin-bottom: 0.85rem;
    }
    .th-hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    /* Cards & Grids on Mobile */
    .th-card-3d, .th-stat-card {
        padding: 1.25rem !important;
        border-radius: 18px;
    }

    /* Tables */
    .table-responsive {
        border-radius: 14px;
        margin-bottom: 1.5rem;
        box-shadow: var(--th-shadow-sm);
        -webkit-overflow-scrolling: touch;
    }
    .table {
        min-width: 600px;
    }

    /* Section Headings */
    .th-section-title {
        font-size: 1.45rem;
    }

    /* Footer */
    .th-footer {
        padding: 2.5rem 0 1.5rem;
        margin-top: 3.5rem;
    }
}

@media (max-width: 575.98px) {
    /* Extra Small / Compact Phones (iPhone SE, 360px - 430px) */
    .th-brand span {
        font-size: 1.15rem;
    }
    .th-hero-title {
        font-size: 1.6rem;
    }
    .th-hero-subtitle {
        font-size: 0.88rem;
    }

    /* Hero Search Bar on Phones */
    .th-search-hero {
        flex-direction: column;
        padding: 0.65rem;
        gap: 0.5rem;
        border-radius: 18px;
    }
    .th-search-hero input {
        width: 100%;
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }
    .th-search-hero button {
        width: 100%;
        padding: 0.65rem;
        justify-content: center;
        border-radius: 12px;
    }

    /* Buttons & Touch Targets */
    .btn, .th-btn-primary, .th-btn-light {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Chat Button in Navbar */
    #thChatToggleBtn {
        padding: 0.35rem 0.65rem !important;
    }
    #thChatToggleBtn span.d-none {
        display: none !important;
    }

    /* User Profile Dropdown */
    .dropdown-toggle {
        padding: 0.35rem 0.65rem !important;
    }
    .dropdown-toggle span {
        max-width: 85px;
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
        font-size: 0.85rem;
    }

    /* Academic Cards & Badges */
    .th-card-3d {
        padding: 1.1rem !important;
        border-radius: 16px;
    }
    .th-3d-icon-box {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    /* Forms */
    .form-control, .form-select {
        font-size: 0.92rem;
        padding: 0.65rem 0.85rem;
        border-radius: 12px;
    }
}

@media (max-width: 380px) {
    /* Ultra-compact screens (320px - 360px) */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .th-brand-logo {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    .th-brand span {
        font-size: 1.05rem;
    }
    .th-hero-title {
        font-size: 1.45rem;
    }
}

