/* =========================
       Theme variables & reset
   ========================= */
:root {
    --bg: #0a0a0f; /* dark mode background */
    --panel: #111;
    --muted: #bbb;
    --text: #fff;
    --accent: #3a6cf4;
    --glass: rgba(255, 255, 255, 0.03);
    --radius: 12px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    --transition: 360ms cubic-bezier(0.2, 0.9, 0.3, 1);
    --hero-bg: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0)
    );
    --bg-gradient: linear-gradient(180deg, #0a0a0f, #130c1a);

    /* NEW: Dark mode icon color */
    --icon: #ffffff;
}

[data-theme="light"] {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --muted: #555;
    --text: #0b0b0b;
    --accent: #2d6ef3;
    --glass: rgba(0, 0, 0, 0.03);
    --shadow: 0 8px 30px rgba(13, 22, 40, 0.06);
    --bg-gradient: #f6f7fb;

    /* NEW: Light mode icon color */
    --icon: #0b0b0b;
}

/* FIXED selector — now only affects LIGHT MODE */
[data-theme="light"] .hero .download-cv,
[data-theme="light"] #modalLink {
    background: var(--accent);
    color: white;
}

/* =========================
       Icon Styling (NEW)
   ========================= */
i,
svg {
    color: var(--icon);
    stroke: var(--icon);
    fill: var(--icon);
    transition: color var(--transition), stroke var(--transition),
        fill var(--transition);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================
       Layout: sticky side menu
   ========================= */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
    align-items: start;
    padding: 28px;
}

/* Side menu */
.side {
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: auto;
    transition: transform 240ms ease, opacity 240ms ease;
    backdrop-filter: blur(6px);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}
.brand .logo {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #7bb1ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.brand h1 {
    font-size: 16px;
    margin: 0;
}
.brand p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

nav.side-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
nav.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: background var(--transition), transform var(--transition);
}
nav.side-nav a:hover {
    background: var(--glass);
    transform: translateX(6px);
}
nav.side-nav a.active {
    background: linear-gradient(
        90deg,
        rgba(58, 108, 244, 0.12),
        rgba(58, 108, 244, 0.04)
    );
    box-shadow: inset 0 0 0 1px rgba(58, 108, 244, 0.06);
    color: var(--accent);
}

.side .controls {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.03);
}
.toggle-btn {
    color: var(--text); /* ← fixes text color */
    border: 1px solid var(--glass); /* matches theme */
    background: var(--panel); /* optional but looks cleaner */
    transition: var(--transition);
}

.toggle-btn:hover {
    opacity: 0.85;
}

/* collapse for small screens: side becomes top */
@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
        padding: 14px;
    }
    .side {
        position: relative;
        height: auto;
        order: 2;
        display: flex;
        flex-direction: row;
        gap: 12px;
        padding: 12px;
        overflow: visible;
    }
    nav.side-nav {
        flex-direction: row;
        gap: 8px;
        overflow: auto;
    }
    .brand p {
        display: none;
    }
}

/* =========================
       Main content
       ========================= */
main {
    padding-bottom: 64px;
}
.hero {
    padding: 36px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    border-radius: var(--radius);
    margin-bottom: 18px;
    background: var(--hero-bg);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition);
}

.hero .download-cv {
    padding: 12px;
    border: none;
    cursor: pointer;
    color: white;
    font-weight: bold;
    border-radius: 8px;
    background: rgba(189, 189, 189, 0.3);
}

.hero h2 {
    font-size: 34px;
    margin: 0 0 6px 0;
}
.hero p {
    color: var(--muted);
    max-width: 760px;
    margin: 0;
}

section {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.012),
        transparent
    );
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 22px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: transform var(--transition), opacity var(--transition);
    opacity: 0;
    transform: translateY(18px) scale(0.995);
}
section.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}

section h3 {
    font-size: 22px;
    margin: 0 0 12px 0;
    padding-left: 10px;
    border-left: 4px solid var(--accent);
    display: inline-block;
}

/* Skills grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}
.skill-box {
    padding: 16px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.02);
    text-align: center;
    font-weight: 700;
    transition: transform var(--transition), box-shadow var(--transition);
}
.skill-box:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}
.project-card {
    padding: 18px;
    border-radius: 12px;
    background: var(--panel);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: transform var(--transition), box-shadow var(--transition),
        opacity 240ms;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
}
.project-card h4 {
    color: var(--accent);
    margin: 0;
    font-size: 16px;
}
.project-card p {
    color: var(--muted);
    margin: 0;
    font-size: 13px;
}

/* Contacts */
.contact-form {
    max-width: 640px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.contact-form input,
.contact-form textarea {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    background: var(--panel);
    color: var(--text);
    transition: box-shadow var(--transition), transform var(--transition);
}
.contact-form button {
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), opacity var(--transition);
}
.contact-form button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
}

/* Modal (projects + gallery) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 8, 0.6);
    z-index: 9999;
    padding: 20px;
    transition: opacity 220ms ease;
}
.modal-backdrop.open {
    display: flex;
}
.custom-modal {
    width: 100%;
    max-width: 920px;
    background: var(--panel);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transform: translateY(10px);
    opacity: 0;
    transition: transform var(--transition), opacity var(--transition);
}
.modal-backdrop.open .custom-modal {
    transform: translateY(0);
    opacity: 1;
}
.custom-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.custom-modal .modal-header button {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--muted);
    transition: color var(--transition);
}
.custom-modal .modal-body {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.custom-modal .modal-body img {
    max-width: 360px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}
.custom-modal .modal-meta {
    flex: 1;
    min-width: 240px;
}

.modal-content {
    max-height: 90vh;
    min-height: 300px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#modalImage {
    max-height: 60vh;
    object-fit: contain;
    width: 100%;
    border-radius: 10px;
}

.custom-modal {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-body {
    overflow-y: hidden; /* 🔥 removes scroll */
    padding-bottom: 8px;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    background: var(--panel);
    border-radius: 0 0 12px 12px;
}

#modalLink {
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.25s ease;
}

#modalLink:hover {
    opacity: 0.85;
}

#demoBtn {
    margin-left: 20px;
    padding: 10px 16px;
    background: transparent; /* no background */
    color: var(--accent); /* accent text */
    border: 2px solid var(--accent); /* accent outline */
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.25s ease;
}

#demoBtn:hover {
    background: rgba(58, 108, 244, 0.15); /* your accent but transparent */
    color: var(--accent);
    opacity: 1;
}

.btn {
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
}
.btn.ghost {
    background: transparent;
    color: var(--text); /* ← fixes black text issue */
    border: 1px solid var(--glass); /* matches your theme system */
    transition: var(--transition);
}

.btn.ghost:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

/* Certificate gallery grid */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.cert-item {
    width: 100%;
    aspect-ratio: 4/3; /* keeps consistent thumbnail shape */
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.08),
        rgba(255, 255, 255, 0.02)
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* crops image to fit nicely */
    display: block;
}
.cert-thumb {
    height: 100px;
    border-radius: 8px;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.08),
        rgba(255, 255, 255, 0.02)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* Lightbox controls inside modal */
.lb-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.lb-controls .btn {
    padding: 8px 10px;
}

/* small helpers */
.muted {
    color: var(--muted);
    font-size: 13px;
}
.row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Smooth anchor scroll */
html {
    scroll-behavior: smooth;
}

/* tiny accessibility focus */
a:focus,
button:focus {
    outline: 3px solid rgba(58, 108, 244, 0.18);
    outline-offset: 3px;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
}

/* Contact */
.contact_field {
    height: 100vh;
    width: 100%;
    background: transparent;
}

.contact_field h3 {
    font-size: 43px;
}

.contact_field h1 {
    font-size: 62px;
}

.contact-header {
    text-align: center;
    padding: 20px;
    width: 100%;
}

.contact-header p {
    text-align: center;
}

/* Apply the blob gradient background */
.contactform {
    border-radius: 44% 36% 34% 28% / 76% 41% 59% 24%;
    background: linear-gradient(
        90deg,
        rgba(131, 58, 180, 1) 0%,
        rgba(253, 29, 29, 1) 50%,
        rgba(252, 176, 69, 1) 100%
    );
    padding: 40px;
    max-width: 600px;
    margin: auto;
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.contactform input,
.contactform textarea {
    padding: 12px;
    border-radius: 8px;
    border: none;
    outline: none;
}

.contactform button {
    padding: 12px;
    border: none;
    cursor: pointer;
    color: white;
    font-weight: bold;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.download-cv {
    display: inline-block; /* makes the button only as wide as the content */
    width: auto; /* ensures it never stretches */
    margin-top: 12px;
    padding: 12px 22px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.download-cv:hover {
    transform: translateY(-3px);
    background: #5a82ff;
}
.badge-container {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Icon-only badge */
.badge-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: transparent;
    position: relative;
    cursor: default;
    color: white;
}

/* Tooltip text above the badge */
.badge-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%; /* position above */
    left: 50%;
    transform: translateX(-50%) translateY(-6px); /* small gap above badge */
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s ease;
    z-index: 10;
}

/* Tooltip arrow pointing down */
.badge-icon::before {
    content: "";
    position: absolute;
    bottom: 100%; /* position at top of badge */
    left: 50%;
    transform: translateX(-50%) translateY(-1px); /* small gap above badge */
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent; /* arrow pointing down */
    opacity: 0;
    transition: 0.2s ease;
    z-index: 10;
}

/* Show tooltip on hover */
.badge-icon:hover::after,
.badge-icon:hover::before {
    opacity: 1;
}

.main-footer {
    margin-top: 60px;
    padding: 30px 20px;
    background: var(--panel);
    border-top: 1px solid var(--glass);
    text-align: center;
    border-radius: 12px 12px 0 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
}

.social-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.25s ease;
}

.social-links a i {
    font-size: 18px;
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.footer-copy {
    font-size: 13px;
    color: var(--muted);
}

/* Profile Modal */
.profile-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 6, 8, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.profile-modal-backdrop.open {
    display: flex;
}

.profile-modal {
    background: var(--panel);
    padding: 20px;
    border-radius: 14px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass);
}

.profile-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text);
}

.profile-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-body a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    transition: 0.25s ease;
}

.profile-body a:hover {
    color: var(--accent);
    transform: translateX(4px);
}

.clickable-profile {
    cursor: pointer;
    transition: 0.25s ease;
}

.clickable-profile:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    margin: 40px auto;
}

.login-card {
    padding: 30px 35px;
    border-radius: 16px;
    background: #1f1f25; /* Dark card */
    color: #eee;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
}

.login-card h2 {
    font-weight: 600;
    margin-bottom: 20px;
    font-family: Poppins, sans-serif;
    text-align: center;
    color: #ffffff;
}

.login-card .form-control {
    border-radius: 10px;
    padding: 12px 14px;
    background: #2a2a31;
    border: 1px solid #3a3a43;
    color: #fff;
}

.login-card .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 0.15rem rgba(99, 102, 241, 0.3);
}

.login-card button {
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.login-card a {
    font-size: 0.85rem;
    color: #9aa0b7;
}

.login-card a:hover {
    color: #c3cae7;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
