/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* General Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Arial', sans-serif;
    background-color: #2e2e2e;
    color: #fff;
    overflow-x: hidden;
    line-height: 1.6;
}

body h1, h2, h3 {
    color: #3d8bff;
    margin-top: 0;
}

body a {
    color: #3d8bff;
    text-decoration: none;
    transition: color 0.3s;
}

body a:hover {
    color: #0f52fd;
}

/* Light mode */
body.light-mode {
    background-color: #e0e0e0;
    color: #000;
}

body.light-mode .sidebar {
    background-color: #d9d9d9;
    color: #000;
}

body.light-mode h1, body.light-mode h2, body.light-mode h3 {
    color: #0854b1;
}

body.light-mode a {
    color: #0854b1;
}

body.light-mode a:hover {
    color: #082ea2;
}

body.light-mode .job,
body.light-mode .project,
body.light-mode .education-item {
    background-color: #c9c9c9;
}

/* Container */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    width: 300px;
    min-width: 280px;
    background-color: #363636;
    padding: 25px 20px 15px;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 1000;
    animation: fadeInLeft 1.5s;
    overflow-y: auto;
    gap: 25px;
}

/* Profile Section */
.profile {
    text-align: center;
    animation: fadeInDown 1s;
}

.profile h1 {
    font-size: clamp(1.5rem, 3.8vw, 2.3rem);
    margin: 12px 0 8px;
    line-height: 1.2;
}

.profile-img {
    width: clamp(160px, 20vw, 200px);
    height: clamp(160px, 20vw, 200px);
    border-radius: 50%;
    margin-bottom: 12px;
    border: 3px solid #ffcc00;
    object-fit: cover;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(61, 139, 255, 0.3);
}

.profile p {
    font-size: clamp(0.9rem, 1.9vw, 1.1rem);
    margin: 6px 0;
    font-weight: 500;
}

/* Social Links Section */
.socials-div {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: fadeInDown 1s;
}

.socials {
    list-style-type: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 0;
    margin: 0;
}

.social {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    padding: 14px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background-color: rgba(61, 139, 255, 0.1);
    backdrop-filter: blur(10px);
}

.social:hover {
    background-color: rgba(61, 139, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(61, 139, 255, 0.3);
}

/* Quick Stats Section */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.stat-item {
    text-align: center;
    background-color: rgba(61, 139, 255, 0.1);
    border-radius: 8px;
    padding: 10px 6px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(61, 139, 255, 0.2);
}

.stat-item:hover {
    background-color: rgba(61, 139, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(61, 139, 255, 0.2);
}

.stat-number {
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 700;
    color: #3d8bff;
    line-height: 1;
    margin-bottom: 2px;
}

.stat-label {
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    color: #ccc;
    font-weight: 500;
    line-height: 1.1;
}

body.light-mode .stat-item {
    background-color: rgba(8, 84, 177, 0.1);
    border-color: rgba(8, 84, 177, 0.2);
}

body.light-mode .stat-item:hover {
    background-color: rgba(8, 84, 177, 0.2);
}

body.light-mode .stat-number {
    color: #0854b1;
}

body.light-mode .stat-label {
    color: #666;
}

/* Controls Section */
.switches {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 25px;
    margin-top: auto;
    padding: 15px 0;
}

.switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flag Switch */
.switch-flag {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 28px;
    background-color: #565656;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.switch-flag:hover {
    box-shadow: 0 6px 20px rgba(61, 139, 255, 0.3);
}

body.light-mode .switch-flag {
    background-color: #b4b4b4;
}

.switch-flag input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.slider-flag {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #ccc;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.flag-wrapper {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.switch-flag input:checked + .slider-flag .flag-wrapper {
    transform: translateX(27px);
}

.flag {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.flag-uk {
    opacity: 0;
}

.flag-es {
    opacity: 1;
}

.switch-flag input:checked + .slider-flag .flag-uk {
    opacity: 1;
}

.switch-flag input:checked + .slider-flag .flag-es {
    opacity: 0;
}

/* Theme Switch */
.switch-theme {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 28px;
    background: linear-gradient(135deg, #5bc0ff, #cfcfcf);
    border-radius: 25px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.switch-theme:hover {
    box-shadow: 0 6px 20px rgba(61, 139, 255, 0.3);
}

body.light-mode .switch-theme {
    background: linear-gradient(135deg, #232323, #5e5e5e);
}

.switch-theme input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.slider-theme {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 25px;
}

.icon-wrapper {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.switch-theme input:checked + .slider-theme .icon-wrapper {
    transform: translateX(27px);
    background-color: #121212;
}

.moon, .sun {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: opacity 0.3s ease;
}

.moon {
    background-color: #d8d8cf;
    box-shadow: 0 0 20px 1px #cfcec6;
    opacity: 0;
}

.moon::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #0f0f0f, #2e2e2e);
    border-radius: 50%;
    top: 0;
    left: 7px;
}

.sun {
    background-color: #ffcc00;
    box-shadow: 0 0 15px 2px #ffcc00;
    opacity: 1;
}

.switch-theme input:checked + .slider-theme .moon {
    opacity: 1;
}

.switch-theme input:checked + .slider-theme .sun {
    opacity: 0;
}

/* Footer Section - Bottom */
.footbar {
    text-align: center;
    padding: 12px 0;
    font-size: clamp(0.65rem, 1.3vw, 0.8rem);
    color: #999;
    border-top: 1px solid rgba(61, 139, 255, 0.2);
}

body.light-mode .footbar {
    color: #666;
    border-top-color: rgba(8, 84, 177, 0.2);
}

/* Flag Switch */
.switch-flag {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 28px;
    background-color: #565656;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.switch-flag:hover {
    box-shadow: 0 6px 20px rgba(61, 139, 255, 0.3);
}

body.light-mode .switch-flag {
    background-color: #b4b4b4;
}

.switch-flag input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.slider-flag {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #ccc;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.flag-wrapper {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.switch-flag input:checked + .slider-flag .flag-wrapper {
    transform: translateX(27px);
}

.flag {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.flag-uk {
    opacity: 0;
}

.flag-es {
    opacity: 1;
}

.switch-flag input:checked + .slider-flag .flag-uk {
    opacity: 1;
}

.switch-flag input:checked + .slider-flag .flag-es {
    opacity: 0;
}

/* Theme Switch */
.switch-theme {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 28px;
    background: linear-gradient(135deg, #5bc0ff, #cfcfcf);
    border-radius: 25px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.switch-theme:hover {
    box-shadow: 0 6px 20px rgba(61, 139, 255, 0.3);
}

body.light-mode .switch-theme {
    background: linear-gradient(135deg, #232323, #5e5e5e);
}

.switch-theme input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.slider-theme {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 25px;
}

.icon-wrapper {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.switch-theme input:checked + .slider-theme .icon-wrapper {
    transform: translateX(27px);
    background-color: #121212;
}

.moon, .sun {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: opacity 0.3s ease;
}

.moon {
    background-color: #d8d8cf;
    box-shadow: 0 0 20px 1px #cfcec6;
    opacity: 0;
}

.moon::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #0f0f0f, #2e2e2e);
    border-radius: 50%;
    top: 0;
    left: 7px;
}

.sun {
    background-color: #ffcc00;
    box-shadow: 0 0 15px 2px #ffcc00;
    opacity: 1;
}

.switch-theme input:checked + .slider-theme .moon {
    opacity: 1;
}

.switch-theme input:checked + .slider-theme .sun {
    opacity: 0;
}

/* Footer Section - Bottom */
.footbar {
    text-align: center;
    padding: 15px 0;
    font-size: clamp(0.65rem, 1.3vw, 0.8rem);
    color: #999;
    border-top: 1px solid rgba(61, 139, 255, 0.2);
    margin-top: 20px;
}

body.light-mode .footbar {
    color: #666;
    border-top-color: rgba(8, 84, 177, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 320px;
    padding: 20px;
    animation: fadeInRight 1.5s;
    max-width: calc(100vw - 340px);
}

.hero {
    margin-bottom: 40px;
}

.hero h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    animation: fadeInDown 1s;
    text-align: center;
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    animation: fadeInDown 1s;
    text-align: justify;
    margin-bottom: 15px;
}

/* Projects */
.projects {
    margin-bottom: 40px;
}

.projects h3 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    margin-bottom: 20px;
}

.project {
    background-color: #515151;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    animation: fadeInUp 1s;
}

.project-title {
    margin-bottom: 10px;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
}

.project-desc {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
    white-space: pre-line;
}

/* Education */
.education {
    margin-bottom: 40px;
}

.education h3 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    margin-bottom: 20px;
}

.education-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #515151;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    animation: fadeInUp 1s;
}

.education-text {
    flex: 1;
    padding-right: 20px;
}

.education-text h4 {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin-bottom: 10px;
}

.education-text p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    margin-bottom: 10px;
}

.education-text ul {
    margin: 0;
    padding-left: 20px;
}

.education-text li {
    font-size: clamp(0.85rem, 1.8vw, 0.95rem);
    margin-bottom: 5px;
}

.education-logo {
    width: clamp(80px, 15vw, 150px);
    height: auto;
    flex-shrink: 0;
}

/* Animations */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background-color: #3d8bff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(61, 139, 255, 0.3);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background-color: #0f52fd;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(61, 139, 255, 0.4);
}

/* Focus styles for accessibility */
.mobile-menu-toggle:focus,
.switch-flag input:focus + .slider-flag,
.switch-theme input:focus + .slider-theme,
a:focus {
    outline: 2px solid #3d8bff;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
        min-width: 260px;
        padding: 25px 15px 15px;
    }

    .main-content {
        margin-left: 300px;
        max-width: calc(100vw - 320px);
    }

    .profile-img {
        width: clamp(120px, 16vw, 160px);
        height: clamp(120px, 16vw, 160px);
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .container {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: 100vh;
        position: fixed;
        top: 0;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
        padding: 20px;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 70px 20px 20px;
    }

    .hero p {
        text-align: left;
    }

    .education-item {
        flex-direction: column;
        text-align: center;
    }

    .education-text {
        padding-right: 0;
        margin-bottom: 15px;
    }

    .education-logo {
        margin: 0;
    }

    /* Mobile sidebar adjustments */
    .profile {
        margin-bottom: 25px;
    }

    .socials-div {
        margin-bottom: 25px;
    }

    .switches {
        flex-direction: row;
        gap: 30px;
        margin-bottom: 30px;
    }

    .switch-container {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 70px 15px 15px;
    }

    .project,
    .education-item {
        padding: 15px;
    }

    .social {
        padding: 8px;
        font-size: 1.3rem;
    }

    .sidebar {
        padding: 15px;
    }

    .switches {
        gap: 20px;
    }
}

@media (max-width: 320px) {
    .main-content {
        padding: 70px 10px 10px;
    }

    .project,
    .education-item {
        padding: 12px;
    }

    .sidebar {
        padding: 12px;
    }
}

/* Landscape mobile adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        padding: 15px 10px;
        gap: 10px;
    }

    .profile {
        margin-bottom: 15px;
    }

    .profile-img {
        width: 70px;
        height: 70px;
        margin-bottom: 8px;
    }

    .profile h1 {
        font-size: 1.3rem;
        margin: 5px 0;
    }

    .socials-div {
        margin-bottom: 15px;
    }

    .social {
        padding: 6px;
        font-size: 1.1rem;
    }

    .switches {
        margin-bottom: 15px;
        gap: 15px;
    }

    .footbar {
        font-size: 0.65rem;
        padding: 8px 0;
        margin-top: 15px;
    }
}