/* Header and Navigation Styles */

/* Basic Styling for Light/Dark Mode */
header {
    position: fixed;
    z-index: 1000;
    width: 100%;
    top: 0;
    left: 0;
    padding: 1rem 0;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

body.dark-mode header {
    background-color: rgba(18, 18, 18, 0.25);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Container layout */
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
}

/* 9webdev Logo styling */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
    z-index: 1002;
    direction: ltr; /* Force LTR direction to keep icon on left always */
    position: relative;

    /* Cool entrance animation - made slower */
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    animation: logoSlideIn 2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.logo::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(147, 51, 234, 0.15) 25%,
    rgba(236, 72, 153, 0.15) 50%,
    rgba(6, 182, 212, 0.15) 75%,
    rgba(16, 185, 129, 0.15) 100%);
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    filter: blur(8px);
}

.logo:hover {
    transform: translateY(-0.5px); /* Minimal lift */
}

.logo:hover::before {
    opacity: 0; /* Remove glow effect completely */
}

.logo-icon {
    position: relative;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.3) 0%,
    rgba(147, 51, 234, 0.3) 30%,
    rgba(236, 72, 153, 0.3) 60%,
    rgba(6, 182, 212, 0.3) 100%
    ),
    rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3),
    0 4px 16px rgba(147, 51, 234, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.3s ease; /* Faster transition */

    /* Simplified icon entrance animation */
    opacity: 0;
    transform: scale(0.5);
    animation: iconFadeIn 1s ease-out 0.5s forwards;
}

body.dark-mode .logo-icon {
    background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.3) 0%,
    rgba(147, 51, 234, 0.3) 30%,
    rgba(236, 72, 153, 0.3) 60%,
    rgba(6, 182, 212, 0.3) 100%
    ),
    rgba(0, 0, 0, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.logo:hover .logo-icon {
    opacity: 0.95; /* Minimal opacity change only */
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
            from 0deg,
            rgba(59, 130, 246, 0.4) 0deg,
            rgba(147, 51, 234, 0.4) 90deg,
            rgba(236, 72, 153, 0.4) 180deg,
            rgba(6, 182, 212, 0.4) 270deg,
            rgba(59, 130, 246, 0.4) 360deg
    );
    animation: rotate 6s linear infinite;
    z-index: -1;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(135deg,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(20, 20, 30, 0.9) 50%,
    rgba(0, 0, 0, 0.8) 100%
    );
    border-radius: 12px;
    z-index: -1;
}

body.dark-mode .logo-icon::after {
    background: linear-gradient(135deg,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(20, 20, 30, 0.95) 50%,
    rgba(0, 0, 0, 0.9) 100%
    );
}

.number-9 {
    font-size: 28px;
    font-weight: 800;
    font-family: 'SF Pro Display', 'Segoe UI Variable', 'Helvetica Neue', 'Arial', sans-serif;
    background: linear-gradient(135deg,
    #ffffff 0%,
    #f8fafc 15%,
    #e2e8f0 30%,
    #cbd5e1 50%,
    #94a3b8 70%,
    #64748b 85%,
    #475569 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(59, 130, 246, 0.2);
    letter-spacing: -1.2px;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0.9;
    transition: all 0.2s ease; /* Faster transition */

    /* Number entrance animation - made slower */
    opacity: 0;
    transform: scale(2) rotate(360deg);
    animation: numberBounceIn 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.2s forwards;
}

.logo:hover .number-9 {
    opacity: 0.9; /* Minimal opacity change only */
}

.text-container {
    display: flex;
    align-items: baseline;
    gap: 0px;
}

.web-text {
    font-size: 26px;
    font-weight: 300;
    font-family: 'Inter', 'SF Pro Display', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: -0.8px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease; /* Faster transition */
    position: relative;

    /* Web text entrance animation - made slower */
    opacity: 0;
    transform: translateX(-30px);
    animation: textSlideInLeft 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.8s forwards;
}

.web-text::after {
    content: 'web';
    position: absolute;
    top: 0;
    left: 0;
    color: rgba(255, 255, 255, 0.1);
    filter: blur(8px);
    z-index: -1;
}

body.dark-mode .web-text {
    color: rgba(255, 255, 255, 0.9);
}

.dev-text {
    font-size: 26px;
    font-weight: 700;
    font-family: 'Inter', 'SF Pro Display', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg,
    #3b82f6 0%,
    #6366f1 15%,
    #8b5cf6 30%,
    #a855f7 45%,
    #ec4899 60%,
    #f43f5e 75%,
    #06b6d4 90%,
    #10b981 100%);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.8px;
    position: relative;
    text-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease; /* Faster transition */

    /* Dev text entrance animation - made slower */
    opacity: 0;
    transform: translateX(30px);
    animation: textSlideInRight 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 2.1s forwards,
    shimmer 4s ease-in-out 3.8s infinite;
}

.dev-text::after {
    content: 'dev';
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.3) 0%,
    rgba(139, 92, 246, 0.3) 25%,
    rgba(236, 72, 153, 0.3) 50%,
    rgba(6, 182, 212, 0.3) 75%,
    rgba(16, 185, 129, 0.3) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: blur(6px);
    z-index: -1;
}

.logo:hover .web-text {
    opacity: 0.95; /* Minimal opacity change only */
}

.logo:hover .dev-text {
    opacity: 0.95; /* Minimal opacity change only */
}

/* Desktop Navigation */
.desktop-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* RTL Navigation */
body.rtl .desktop-nav {
    margin-left: 2rem;
    margin-right: 0;
}

.desktop-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    /* Force navigation items to maintain original order in RTL */
    flex-direction: row !important;
}

.desktop-nav ul li {
    margin-left: 2rem;
}

/* RTL Navigation Items */
body.rtl .desktop-nav ul li {
    margin-right: 2rem;
    margin-left: 0;
}

body.rtl .desktop-nav ul {
    flex-direction: row !important;
}

.desktop-nav a {
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
    position: relative;
    padding: 0.5rem 0;
    transition: all 0.3s ease;
}

body.dark-mode .desktop-nav a {
    color: var(--text-dark);
}

.desktop-nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.desktop-nav a:hover {
    color: var(--primary-color);
}

.desktop-nav a:hover::after {
    width: 100%;
}

body.rtl .desktop-nav a::after {
    left: auto;
    right: 0;
}

/* Controls section (theme toggle only) */
.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

/* RTL Controls */
body.rtl .controls {
    margin-right: 0;
    margin-left: auto;
    order: unset;
}

/* Contact Button - From Uiverse.io by Spacious74 */
.contact-btn-container {
    position: relative;
    padding: 3px;
    background: linear-gradient(90deg, #03a9f4, #f441a5);
    border-radius: 0.9em;
    transition: all 0.4s ease;
}

.contact-btn-container::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    border-radius: 0.9em;
    z-index: -10;
    filter: blur(0);
    transition: filter 0.4s ease;
}

.contact-btn-container:hover::before {
    background: linear-gradient(90deg, #03a9f4, #f441a5);
    filter: blur(1.2em);
}

.contact-btn-container:active::before {
    filter: blur(0.2em);
}

.contact-button {
    font-size: 1.1em;
    padding: 0.5em 0.7em;
    border-radius: 0.5em;
    border: none;
    background-color: #000;
    color: #fff;
    cursor: pointer;
    box-shadow: 2px 2px 3px #000000b4;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

body.dark-mode .contact-button {
    background-color: #000;
}

/* Theme Switch */
/* From Uiverse.io by Type-Delta */
/* a clone from joshwcomeau.com 
 * but this version runs on pure CSS
 */

.themeToggle {
    color: #bbb;
    width: 3em;
}

.st-sunMoonThemeToggleBtn {
    position: relative;
    cursor: pointer;
}

.st-sunMoonThemeToggleBtn .themeToggleInput {
    opacity: 0;
    width: 32px;
    height: 16px;
    margin: auto;
    align-items: center;
    justify-content: center;
}

.st-sunMoonThemeToggleBtn svg {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease;
    transform: rotate(40deg);
}

.st-sunMoonThemeToggleBtn svg .sunMoon {
    transform-origin: center center;
    transition: inherit;
    transform: scale(1);
}

.st-sunMoonThemeToggleBtn svg .sunRay {
    transform-origin: center center;
    transform: scale(0);
}

.st-sunMoonThemeToggleBtn svg mask > circle {
    transition: transform 0.64s cubic-bezier(0.41, 0.64, 0.32, 1.575);
    transform: translate(0px, 0px);
}

.st-sunMoonThemeToggleBtn svg .sunRay2 {
    animation-delay: 0.05s !important;
}

.st-sunMoonThemeToggleBtn svg .sunRay3 {
    animation-delay: 0.1s !important;
}

.st-sunMoonThemeToggleBtn svg .sunRay4 {
    animation-delay: 0.17s !important;
}

.st-sunMoonThemeToggleBtn svg .sunRay5 {
    animation-delay: 0.25s !important;
}

.st-sunMoonThemeToggleBtn svg .sunRay6 {
    animation-delay: 0.29s !important;
}

.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg {
    transform: rotate(90deg);
}

.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg mask > circle {
    transform: translate(16px, -3px);
}

.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg .sunMoon {
    transform: scale(0.55);
}

.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg .sunRay {
    animation: showRay1832 0.4s ease 0s 1 forwards;
}

/* Light mode = Show SUN (golden) */
body:not(.dark-mode) .st-sunMoonThemeToggleBtn svg .sunMoon {
    fill: #fbbf24; /* Golden sun for light mode */
}

body:not(.dark-mode) .st-sunMoonThemeToggleBtn svg .sunRay {
    fill: #f59e0b; /* Golden rays for light mode */
}

/* Dark mode = Show MOON (silver-blue) */
body.dark-mode .st-sunMoonThemeToggleBtn svg .sunMoon {
    fill: #94a3b8; /* Silver-blue moon for dark mode */
}

body.dark-mode .st-sunMoonThemeToggleBtn svg .sunRay {
    fill: transparent; /* Hide rays in dark mode (moon has no rays) */
}

@keyframes showRay1832 {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
}

/* Hamburger Button - Mobile Only */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002; /* Above mobile nav */
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    transition: all 0.3s ease;
}

body.dark-mode .hamburger span {
    background-color: var(--text-dark);
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    visibility: hidden;
}

body.dark-mode .mobile-nav {
    background-color: rgba(18, 18, 18, 0.98);
}

body.rtl .mobile-nav {
    left: auto;
    right: 0;
    transform: translateX(-100%);
}

.mobile-nav.active {
    transform: translateX(0);
    visibility: visible;
}

body.rtl .mobile-nav.active {
    transform: translateX(0);
}

.mobile-nav nav {
    width: 100%;
    text-align: center;
}

/* Force mobile navigation to maintain original order regardless of RTL */
.mobile-nav nav ul {
    flex-direction: column !important;
}

body.rtl .mobile-nav nav ul {
    flex-direction: column !important;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.mobile-nav li {
    margin: 1.5rem 0;
}

.mobile-nav a {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

body.dark-mode .mobile-nav a {
    color: var(--text-dark);
}

.mobile-nav a:hover {
    color: var(--primary-color);
}

.mobile-nav .controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

body.rtl .mobile-nav .controls {
    flex-direction: row;
}

/* Contact Button Mobile Styles */
.mobile-nav .contact-btn-container {
    margin-bottom: 1rem;
}

.mobile-nav .contact-button {
    font-size: 1em;
    padding: 0.4em 0.6em;
}

/* Hamburger Animation */
.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Animation keyframes */
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes logoSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-5px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }
}

@keyframes iconFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes numberBounceIn {
    0% {
        opacity: 0;
        transform: scale(2) rotate(360deg);
    }
    60% {
        opacity: 0.8;
        transform: scale(0.9) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes textSlideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0px);
    }
}

@keyframes textSlideInRight {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0px);
    }
}

/* Responsive Sizes for different header contexts */
.logo.small {
    gap: 6px;
}

.logo.small .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.logo.small .number-9 {
    font-size: 20px;
}

.logo.small .web-text,
.logo.small .dev-text {
    font-size: 22px;
    letter-spacing: -0.6px;
}

.logo.large {
    gap: 10px;
}

.logo.large .logo-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
}

.logo.large .number-9 {
    font-size: 28px;
}

.logo.large .web-text,
.logo.large .dev-text {
    font-size: 30px;
    letter-spacing: -1px;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .desktop-nav ul li {
        margin-left: 1.5rem;
    }

    /* RTL support for desktop */
    body.rtl .desktop-nav ul li {
        margin-left: 0;
        margin-right: 1.5rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.8rem 0;
    }

    .desktop-nav {
        display: none;
    }

    .hamburger {
        display: flex;
        z-index: 1010;
    }

    .logo {
        font-size: 1.3rem;
    }

    .controls {
        display: none;
    }

    .mobile-nav .controls {
        display: flex;
        margin-top: 3rem;
        justify-content: center;
    }

    /* Contact Button Mobile Styles */
    .mobile-nav .contact-btn-container {
        margin-bottom: 1rem;
    }

    .mobile-nav .contact-button {
        font-size: 1em;
        padding: 0.4em 0.6em;
    }

    /* RTL Mobile Adjustments */
    body.rtl .hamburger {
        margin-right: auto;
        margin-left: 0;
    }

    /* Ensure mobile menu items are RTL */
    body.rtl .mobile-nav nav ul {
        flex-direction: column !important;
    }
}
