/* =========== GLOBAL STYLES =========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    background-color: #f8f9fa; /* Light grey background */
    color: #343a40;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 40px auto;
    background-color: #ffffff; /* White paper effect */
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

h1, h2, h3 {
    font-weight: 600;
    color: #212529;
}

h1 {
    font-size: 2.8rem;
    color: #0d6efd; /* Primary blue */
    margin-bottom: 8px;
}

h2 {
    font-size: 1.8rem;
    color: #0d6efd;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 10px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    font-size: 1.3rem;
    color: #343a40;
}

a {
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

ul {
    padding-left: 20px;
}

li {
    margin-bottom: 12px;
    color: #495057;
}

section {
    padding: 30px 40px;
    /* Animation for page load */
    animation: fadeIn 0.7s ease-out;
}

section:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

/* =========== HEADER & CONTACT =========== */
header {
    padding: 40px;
    background-color: #f8f9fa; /* Slight off-white for header */
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-actions {
    display: flex;
    flex-direction: column; /* Always stack */
    gap: 10px; /* Space between buttons */
    align-items: flex-end; /* Align to the right side */
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

.contact-info a {
    color: #495057;
    font-weight: 500;
}

.contact-info a i {
    margin-right: 8px;
    color: #0d6efd;
    width: 20px; /* Aligns icons */
    text-align: center;
}

/* Shared Button Styles (Refactored) */
.std-btn {
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    width: 100%; /* Ensure consistency in stack */
    min-width: 200px; /* Minimum width for better look */
    text-align: center;
}

.std-btn i {
    margin-right: 8px;
}

.std-btn:hover {
    text-decoration: none;
    transform: translateY(-3px);
    color: #ffffff;
}

/* Specific Button Colors */
.btn-download {
    background-color: #198754; /* Green */
}

.btn-download:hover {
    background-color: #157347;
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.3);
}

/* =========== SKILLS =========== */
.skills ul {
    list-style-type: none;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skills li {
    background-color: #e9ecef;
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.skills li strong {
    color: #212529;
    font-weight: 600;
}

/* =========== EXPERIENCE =========== */
.job {
    margin-bottom: 30px;
}

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

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 15px;
    margin-bottom: 8px;
}

.job-date {
    font-style: italic;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
    flex-shrink: 0;
}

.job ul {
    margin-top: 15px;
}

/* =========== EDUCATION =========== */
.school:not(:last-child) {
    margin-bottom: 15px;
}

.education p {
    font-style: italic;
    color: #495057;
    margin: 0;
}

/* =========== FOOTER =========== */
footer {
    text-align: center;
    padding: 30px 40px;
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 0.9rem;
}

/* =========== ANIMATIONS =========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========== RESPONSIVE DESIGN =========== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 30px;
    }

    .header-actions {
        width: 100%;
        margin-top: 20px;
        align-items: center; /* Center buttons on mobile */
    }

    .std-btn {
        width: 100%;
    }

    section {
        padding: 30px 25px;
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .job-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========== AI BUILDER BUTTON & OVERLAY =========== */

.ai-builder-btn {
    background-color: #6f42c1; /* Purple */
}

.ai-builder-btn:hover {
    background-color: #59359a; /* Darker Purple */
    box-shadow: 0 6px 16px rgba(111, 66, 193, 0.3);
}

/* Full Screen Overlay */
#aiBuilderView {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffffff;
    z-index: 9999;
    flex-direction: column;
}

.iframe-header {
    flex: 0 0 auto;
    height: 70px;
    background-color: #212529;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Group the title and selector together */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.header-title i {
    color: #6f42c1; /* Purple flask */
}

/* Style the Dropdown */
.version-select {
    background-color: #343a40;
    color: white;
    border: 1px solid #495057;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.version-select:hover, .version-select:focus {
    border-color: #0d6efd;
}

.iframe-header .back-btn {
    background-color: #dc3545; /* Red */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.iframe-header .back-btn:hover {
    background-color: #bb2d3b;
}

#aiIframe {
    flex: 1 1 auto;
    width: 100%;
    border: none;
    background-color: #f8f9fa;
}

/* =========== CHATBOT MODAL STYLES =========== */

.chat-modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.chat-modal-content {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    margin: 15vh auto;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.chat-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 5px 15px;
    align-self: flex-end;
    cursor: pointer;
}

.chat-modal-close:hover,
.chat-modal-close:focus {
    color: #333;
    text-decoration: none;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
}

.chat-message.bot {
    background-color: #f1f3f5;
    color: #212529;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background-color: #0d6efd;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* NEW: Error message style */
.chat-error-message {
    color: #d9534f; /* A standard error red */
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0 20px 5px 20px;
    display: none; /* Hidden by default */
}

.chat-input-area {
    display: flex;
    border-top: 1px solid #e9ecef;
    padding: 10px;
}

#chatTextarea {
    flex-grow: 1;
    border: none;
    padding: 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    height: 50px;
}
#chatTextarea:focus {
    outline: none;
}

#chatSendBtn {
    border: none;
    background-color: #0d6efd;
    color: white;
    font-size: 1.2rem;
    padding: 0 18px;
    border-radius: 8px;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease;
}

#chatSendBtn:hover {
    background-color: #0a58ca;
}

#chatSendBtn:disabled {
    background-color: #6c757d;
    opacity: 0.7;
    cursor: not-allowed;
}
