/* ==================== Font Face ==================== */
@font-face {
    font-family: 'Changa';
    src: url('../fonts/Changa/Changa-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Changa';
    src: url('../fonts/Changa/Changa-SemiBold.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Changa';
    src: url('../fonts/Changa/Changa-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ==================== CSS Variables ==================== */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-button: #2d2d2d;
    --bg-button-hover: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #3a3a3a;
    --shadow: rgba(0, 0, 0, 0.3);
    --theme-icon-sun: none;
    --theme-icon-moon: block;
}

[data-theme="light"] {
    /* Light Theme */
    --bg-primary: #e5e5e5;
    --bg-secondary: #d0d0d0;
    --bg-button: #c8c8c8;
    --bg-button-hover: #b8b8b8;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --border-color: #b0b0b0;
    --shadow: rgba(0, 0, 0, 0.1);
    --theme-icon-sun: block;
    --theme-icon-moon: none;
}

/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Changa', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.6;
}

/* ==================== Theme Toggle ==================== */
.theme-toggle {
    position: fixed;
    top: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--bg-button);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 4px 12px var(--shadow);
}

.theme-toggle:hover {
    transform: scale(1.1);
    background-color: var(--bg-button-hover);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
    display: var(--theme-icon-sun);
}

.moon-icon {
    display: var(--theme-icon-moon);
}

/* ==================== Container ==================== */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ==================== Profile Section ==================== */
.profile-section {
    display: flex;
    align-items: flex-start;
    gap: 25px;
    margin-bottom: 30px;
    flex-direction: row;
    /* RTL: image on right (first in HTML order) */
}

.profile-image {
    flex-shrink: 0;
}

.profile-image img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.profile-info {
    flex: 1;
    text-align: right;
    /* RTL */
}

.profile-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.profile-title {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 400;
}

.profile-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    justify-content: flex-start;
    /* RTL */
}

.profile-location svg {
    flex-shrink: 0;
}

/* ==================== Bio Section ==================== */
.bio-section {
    margin-bottom: 40px;
}

.bio-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: justify;
    direction: rtl;
}

.bio-initial {
    font-size: 1.3em;
    font-weight: 700;
}

/* ==================== Actions Grid ==================== */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 30px;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    background-color: var(--bg-button);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    flex-direction: row-reverse;
    /* RTL: icon on right */
}

.action-button:hover {
    transform: scale(1.02);
    background-color: var(--bg-button-hover);
    box-shadow: 0 6px 20px var(--shadow);
}

.action-button:active {
    transform: scale(0.98);
}

.button-icon {
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-button:hover .button-icon {
    transform: rotate(-5deg) scale(1.1);
}

.button-text {
    flex: 1;
    text-align: right;
    /* RTL */
}

.arrow-icon {
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(10px);
    /* RTL: slide from left */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-button:hover .arrow-icon {
    opacity: 1;
    transform: translateX(0);
}

/* ==================== Responsive Design ==================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .profile-name {
        font-size: 1.75rem;
    }

    .bio-text {
        font-size: 1rem;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    body {
        padding: 15px;
    }

    .theme-toggle {
        top: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
    }

    .profile-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .profile-image img {
        width: 100px;
        height: 100px;
    }

    .profile-info {
        text-align: center;
    }

    .profile-name {
        font-size: 1.5rem;
    }

    .profile-title {
        font-size: 0.9rem;
    }

    .profile-location {
        justify-content: center;
    }

    .bio-text {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .actions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .action-button {
        padding: 16px 20px;
        font-size: 0.9rem;
    }

    /* Always show arrow on mobile for better UX */
    .arrow-icon {
        opacity: 0.7;
        transform: translateX(0);
    }

    .action-button:hover .arrow-icon {
        opacity: 1;
    }
}

/* Small Mobile (< 400px) */
@media (max-width: 399px) {
    .profile-name {
        font-size: 1.3rem;
    }

    .action-button {
        padding: 14px 18px;
        font-size: 0.85rem;
        gap: 10px;
    }

    .button-icon,
    .arrow-icon {
        width: 18px;
        height: 18px;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .theme-toggle {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }

    .action-button {
        page-break-inside: avoid;
    }
}

/* ==================== Accessibility ==================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.action-button:focus,
.theme-toggle:focus {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

.action-button:focus:not(:focus-visible),
.theme-toggle:focus:not(:focus-visible) {
    outline: none;
}