/* Theme Variable Declarations */
:root {
    --primary: #10b981;          /* RecipePak Deep Emerald */
    --primary-light: rgba(16, 185, 129, 0.08);
    --accent: #ff3b30;
    
    /* Light Theme Hexes */
    --background: #f5f5f5;       /* AppColors.background */
    --on-background: #111111;    /* AppColors.onBackground */
    --surface: #ffffff;          /* AppColors.surface */
    --on-surface: #111111;       /* AppColors.onSurface */
    --surface-variant: #f0f0f0;  /* AppColors.surfaceVariant */
    --on-surface-variant: #616161;/* AppColors.onSurfaceVariant */
    --border: #d6d6d6;           /* AppColors.border */
    --shadow: rgba(0, 0, 0, 0.02);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.dark {
    /* Dark Theme Hexes */
    --background: #141414;       /* AppColors.backgroundDark */
    --on-background: #f5f5f5;    /* AppColors.onBackgroundDark */
    --surface: #1c1c1c;          /* AppColors.surfaceDark */
    --on-surface: #f5f5f5;       /* AppColors.onSurfaceDark */
    --surface-variant: #222222;  /* AppColors.surfaceVariantDark */
    --on-surface-variant: #d4d4d4;/* AppColors.onSurfaceVariantDark */
    --border: #303030;           /* AppColors.borderDark */
    --shadow: rgba(0, 0, 0, 0.25);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    background-color: var(--background);
    color: var(--on-background);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--background);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--on-surface-variant);
}

/* DASHBOARD LAYOUT */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR LAYOUT (Left Column - Fixed on Desktop) */
.sidebar {
    width: 320px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    overflow-y: auto;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
}

.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.brand-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.05em;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* Theme Switch Button */
.theme-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface-variant);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.theme-btn:hover {
    background-color: var(--surface-variant);
    border-color: var(--on-surface-variant);
    color: var(--on-background);
}

/* Sun/Moon Toggle Icons */
.sun-icon {
    display: none;
}
.moon-icon {
    display: block;
}

body.dark .sun-icon {
    display: block;
}
body.dark .moon-icon {
    display: none;
}

/* Profile Info */
.profile-header {
    margin-bottom: 1.5rem;
}

.profile-name {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--on-background);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.profile-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 1rem;
}

.profile-tagline {
    font-size: 0.95rem;
    color: var(--on-surface-variant);
    font-weight: 400;
    line-height: 1.5;
}

/* Pulsing Status dot badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--primary-light);
    border: 1px solid rgba(16, 185, 129, 0.12);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    margin-bottom: 1.25rem;
    width: fit-content;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Topbar horizontal nav */
.topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background-color: rgba(245, 245, 245, 0.85); /* Matches light background */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 3rem;
    margin-left: -3rem; /* Negate main-content padding */
    margin-right: -3rem; /* Negate main-content padding */
    margin-top: -4rem; /* Negate main-content padding */
    margin-bottom: 2rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

body.dark .topbar {
    background-color: rgba(20, 20, 20, 0.85); /* Matches dark background */
}

.topbar-actions {
    flex-shrink: 0;
}

/* Language Selector custom arrow styling */
.lang-select {
    background-color: var(--surface-variant);
    border: 1px solid var(--border);
    color: var(--on-surface-variant);
    border-radius: 8px;
    padding: 0.45rem 2.2rem 0.45rem 0.75rem; /* Space on right for custom arrow */
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    
    /* Disable default browser arrow */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    
    /* Vector Chevron Down SVG */
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23616161' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

body.dark .lang-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23d4d4d4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}

.lang-select:hover, .lang-select:focus {
    border-color: var(--primary);
    background-color: var(--surface);
    color: var(--on-background);
}

.topbar-nav {
    display: flex;
    gap: 2.25rem;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
}

.topbar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--on-surface-variant);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
}

.topbar-nav .nav-item:hover {
    color: var(--on-background);
}

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

.topbar-nav .nav-number {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    opacity: 0.85;
}

/* Sidebar footer */
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-socials {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.sidebar-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--surface-variant);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-social-icon:hover {
    border-color: var(--primary);
    background-color: var(--surface);
    transform: translateY(-2px);
}

.social-brand-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.copyright {
    font-size: 0.8rem;
    color: var(--on-surface-variant);
    opacity: 0.6;
    line-height: 1.4;
}

.made-with {
    font-size: 0.7rem;
    display: block;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* MAIN SCROLLABLE CONTENT AREA */
.main-content {
    margin-left: 320px; /* Offset width of fixed sidebar */
    flex-grow: 1;
    padding: 4rem 3rem;
    max-width: 1120px; /* Restrict width of right panel for optimal reading */
}

/* SECTION GLOBAL CLASS */
.section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--border);
}

.section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--on-background);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* About Section text */
.about-text p {
    color: var(--on-surface-variant);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
    max-width: 700px;
}

.about-text p:last-child {
    margin-bottom: 0;
}

/* DASHBOARD GRIDS */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* CARDS COMMON STYLING */
.skill-card, .project-card, .contact-card, .experience-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow);
}

.skill-card:hover, .project-card:hover, .contact-card:hover, .experience-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px var(--shadow);
}

/* EXPERIENCE CARD STYLING */
.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.experience-role-box {
    display: flex;
    flex-direction: column;
}

.experience-role {
    font-size: 1.25rem;
    font-weight: 750;
    color: var(--on-background);
}

.experience-company {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 0.15rem;
}

.experience-meta-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.experience-date {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--on-surface-variant);
}

.experience-location {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.experience-bullets {
    list-style-type: none;
    margin-top: 1.25rem;
}

.experience-bullets li {
    margin-bottom: 0.65rem;
    position: relative;
    padding-left: 1.25rem;
    color: var(--on-surface-variant);
    font-size: 0.95rem;
}

.experience-bullets li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    display: inline-block;
    width: 1rem;
    margin-left: -1rem;
    position: absolute;
    left: 0.25rem;
}

@media (max-width: 600px) {
    .experience-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .experience-meta-box {
        align-items: flex-start;
        text-align: left;
    }
}

/* Skill Card specific typography */
.skill-card h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--on-background);
}

/* Skill tags/chips container */
.skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.skill-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background-color: var(--surface-variant);
    border: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--on-background);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.skill-card:hover .skill-chip {
    border-color: var(--border);
}

.skill-chip:hover {
    background-color: var(--surface);
    border-color: var(--primary) !important;
}

.tech-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

/* PROJECT CARDS */
.project-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-bullets {
    list-style-type: none;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.project-bullets li {
    margin-bottom: 0.65rem;
    position: relative;
    padding-left: 1.25rem;
    color: var(--on-surface-variant);
    font-size: 0.95rem;
}

.project-bullets li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    display: inline-block;
    width: 1rem;
    margin-left: -1rem;
    position: absolute;
    left: 0.25rem;
}

.project-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.project-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.project-card:hover .project-icon {
    transform: scale(1.1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.project-name {
    font-size: 1.25rem;
    font-weight: 750;
    color: var(--on-background);
}

.project-badge {
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--surface-variant);
    color: var(--on-surface-variant);
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
}

.project-desc {
    color: var(--on-surface-variant);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1; /* Match heights */
}

/* Tech tag elements */
.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.tech-tag {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background-color: var(--surface-variant);
    border: 1px solid var(--border);
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--on-background);
}

.tag-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

.project-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.repo-status::before {
    content: "🔒 ";
}

/* Project template app styling */
.template-card {
    border-style: dashed;
    background-color: transparent;
    box-shadow: none;
}

.template-card:hover {
    box-shadow: none;
}

/* CONTACT FORM CONTAINER */
.contact-form-container {
    max-width: 650px;
    margin-top: 1.5rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input, .form-group textarea {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--on-background);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    width: 100%;
    transition: border-color 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    align-self: flex-start;
}

.submit-btn:hover {
    background-color: #0d9668; /* Slightly darker emerald */
}

.submit-btn:active {
    transform: scale(0.98);
}

.form-actions {
    display: flex;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .form-group-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

@media (max-width: 480px) {
    .submit-btn {
        width: 100%;
        text-align: center;
        align-self: stretch;
    }
}

/* RESPONSIVE LAYOUT adjustments */
@media (max-width: 992px) {
    .dashboard-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 3rem 2rem;
    }
    
    .status-badge {
        margin-bottom: 1.5rem;
    }
    
    .main-content {
        margin-left: 0;
        padding: 3rem 2rem;
    }

    .topbar {
        margin-left: -2rem;
        margin-right: -2rem;
        margin-top: -3rem;
        padding: 1.25rem 2rem;
    }
}

@media (max-width: 650px) {
    .skills-grid, .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        padding: 2.5rem 1.5rem;
    }
    
    .main-content {
        padding: 2.5rem 1.5rem;
    }

    .topbar {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        margin-top: -2.5rem;
        padding: 1rem 1.5rem;
    }
    
    .topbar-nav {
        gap: 1.25rem;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none; /* Hide scrollbar on Firefox */
    }
    
    .topbar-nav::-webkit-scrollbar {
        display: none; /* Hide scrollbar on Chrome/Safari */
    }
}

/* RIGHT-TO-LEFT (RTL) STYLING OVERRIDES FOR ARABIC */
@media (min-width: 993px) {
    html[dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        border-right: none;
        border-left: 1px solid var(--border);
    }
    
    html[dir="rtl"] .main-content {
        margin-left: 0;
        margin-right: 320px;
    }
}

html[dir="rtl"] .experience-bullets li {
    padding-right: 1.25rem;
    padding-left: 0;
}

html[dir="rtl"] .experience-bullets li::before {
    right: 0.25rem;
    left: auto;
}

html[dir="rtl"] .project-bullets li {
    padding-right: 1.25rem;
    padding-left: 0;
}

html[dir="rtl"] .project-bullets li::before {
    right: 0.25rem;
    left: auto;
}

/* RTL Selector mirror overrides */
html[dir="rtl"] .lang-select {
    background-position: left 0.75rem center;
    padding-left: 2.2rem;
    padding-right: 0.75rem;
}
