/**
 * Main Styles
 * Core layout, reset, and base styles
 */

/* =========================================================================
   RESET & BASE
   ========================================================================= */

*,
*::before,
*::after {
    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-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-gray-300);
    background-color: var(--color-darker);
    min-height: 100vh;
    overflow-x: hidden;
}

.wrapper {
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

/* Global Background Canvas */
.global-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

/* Selection */
::selection {
    background-color: var(--color-primary);
    color: white;
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lists */
ul,
ol {
    list-style: none;
}

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

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--spacing-4);
}

.mt-2 {
    margin-top: var(--spacing-2);
}

/* =========================================================================
   PRELOADER
   ========================================================================= */

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-inner {
    text-align: center;
}

.preloader-icon {
    width: 50px;
    height: 50px;
    position: relative;
    animation: preloaderRotate 2s linear infinite;
}

.preloader-icon .dot {
    position: absolute;
    width: 60%;
    height: 60%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: 50%;
    animation: preloaderBounce 2s ease-in-out infinite;
}

.preloader-icon .dot-1 {
    top: 0;
    left: 0;
}

.preloader-icon .dot-2 {
    bottom: 0;
    right: 0;
    animation-delay: -1s;
}

@keyframes preloaderRotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes preloaderBounce {

    0%,
    100% {
        transform: scale(0);
    }

    50% {
        transform: scale(1);
    }
}

/* =========================================================================
   LAYOUT
   ========================================================================= */

.wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--color-dark) 0%, var(--color-darker) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: var(--z-fixed);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-normal);
}

html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: var(--spacing-8) var(--spacing-6);
}

/* Profile Photo */
.profile-photo {
    text-align: center;
    margin-bottom: var(--spacing-6);
}

.photo-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.photo-border {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-accent));
    animation: rotateBorder 4s linear infinite;
}

@keyframes rotateBorder {
    100% {
        transform: rotate(360deg);
    }
}

.photo {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--color-dark);
}

/* Profile Info */
.profile-info {
    text-align: center;
    margin-bottom: var(--spacing-8);
}

.profile-name {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-2);
    background: linear-gradient(135deg, var(--color-light), var(--color-gray-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-title {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    font-family: var(--font-mono);
    min-height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-text {
    display: inline;
    color: inherit;
}

.typing-cursor {
    display: inline;
    color: var(--color-primary);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Navigation */
.main-nav {
    flex: 1;
    margin-bottom: var(--spacing-8);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4);
    color: var(--color-gray-400);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-light);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active::before {
    transform: scaleY(1);
}

html[dir="rtl"] .nav-link::before {
    left: auto;
    right: 0;
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-6);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-gray-400);
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
}

.social-link:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

/* Sidebar Footer */
.sidebar-footer {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
}

/* =========================================================================
   MOBILE HEADER
   ========================================================================= */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: var(--z-fixed);
    padding: 0 var(--spacing-4);
    align-items: center;
    justify-content: space-between;
}

html[dir="rtl"] .mobile-header {
    flex-direction: row-reverse;
}

.mobile-logo .W {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-light);

}

.mobile-menu-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-light);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* =========================================================================
   MAIN CONTENT
   ========================================================================= */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

html[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

.content-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--spacing-8);
}

/* =========================================================================
   SECTIONS
   ========================================================================= */

.section {
    min-height: auto;
    padding: var(--spacing-16) 0;
    display: block;
    opacity: 1;
    margin-bottom: var(--spacing-8);
}

.section:last-child {
    margin-bottom: 0;
}

.section.active {
    display: block;
    opacity: 1;
}

.section-content {
    background: var(--color-dark);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-10);
    box-shadow: var(--shadow-2xl), var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: var(--spacing-12);
    position: relative;
}

.section-title {
    position: relative;
    display: inline-block;
    font-size: var(--font-size-4xl);
    font-weight: 800;
    margin-bottom: var(--spacing-4);
}

.section-title .title-text {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, var(--color-light), var(--color-gray-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-title .title-bg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: 800;
    color: var(--color-gray-800);
    opacity: 0.3;
    white-space: nowrap;
    z-index: 0;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.section-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-gray-500);
}

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-6);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--color-light);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

/* =========================================================================
   THEME SWITCHER
   ========================================================================= */

.theme-switcher {
    position: fixed;
    right: var(--spacing-6);
    bottom: var(--spacing-6);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.3);
    transition: all var(--transition-fast);
}

.theme-switcher:hover {
    transform: scale(1.1) rotate(15deg);
}

/* Theme Panel */
.theme-panel {
    position: fixed;
    right: var(--spacing-6);
    bottom: calc(var(--spacing-6) + 60px);
    width: 280px;
    background: var(--color-dark);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: var(--z-fixed);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-fast);
}

.theme-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.theme-panel-header h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-light);
}

.theme-panel-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-light);
}

.theme-options {
    padding: var(--spacing-4);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.theme-option.active {
    border-color: var(--theme-preview);
    background: rgba(255, 255, 255, 0.05);
}

.theme-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.theme-name {
    font-size: var(--font-size-sm);
    color: var(--color-gray-300);
}

/* =========================================================================
   SCROLLBAR
   ========================================================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-700);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-600);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray-700) var(--color-darker);
}