/* ========================================
   Modern Resume Styles
   ======================================== */

/* CSS Variables */
:root {
    --color-primary: #1a1a2e;
    --color-secondary: #4a4a68;
    --color-accent: #0059b3;
    --color-light: #6b7280;
    --color-border: #e5e7eb;
    --color-bg: #f9fafb;
    --color-white: #ffffff;

    --font-primary: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    --line-height: 1.5;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--color-primary);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

/* Resume Container */
.resume-container {
    max-width: 800px;
    margin: var(--spacing-lg) auto;
    padding: var(--spacing-xl);
    background: var(--color-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* ========================================
   Header Styles
   ======================================== */

.resume-header {
    position: relative;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--color-primary);
}

/* Download button - top right */
.download-btn {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-accent);
    color: var(--color-white);
    text-decoration: none;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}

.download-btn:hover {
    background: #004494;
    transform: translateY(-1px);
}

.download-btn svg {
    width: 16px;
    height: 16px;
}

.header-content {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
}

/* Left column: Photo + icons */
.header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.profile-image {
    flex-shrink: 0;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-border);
}

.header-text {
    flex: 1;
    padding-top: var(--spacing-sm);
}

.name {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.025em;
}

.title {
    font-size: var(--font-size-lg);
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

/* Contact Icons (Web) - under photo */
.contact-icons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: var(--spacing-xs);
    border-radius: 4px;
}

.contact-link:hover {
    color: var(--color-accent);
    transform: translateY(-1px);
    background: rgba(0, 89, 179, 0.05);
}

.contact-link svg {
    width: 18px;
    height: 18px;
}

/* Contact Text (PDF) - Hidden by default */
.contact-text {
    display: none;
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    margin-top: var(--spacing-sm);
}

.contact-text .separator {
    margin: 0 var(--spacing-sm);
    color: var(--color-light);
}

/* ========================================
   Section Styles
   ======================================== */

.section {
    margin-bottom: var(--spacing-lg);
}

.section-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-primary);
    padding-bottom: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

/* Summary Section */
.summary-text {
    color: var(--color-secondary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
}

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

.summary-text em {
    color: var(--color-light);
    font-size: var(--font-size-sm);
}

/* Skills Section */
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.skill {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    font-weight: 500;
}

/* ========================================
   Experience Section
   ======================================== */

.job {
    margin-bottom: var(--spacing-lg);
}

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

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
    gap: var(--spacing-md);
}

.job-title-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.job-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

.job-company {
    font-size: var(--font-size-base);
    color: var(--color-accent);
    font-weight: 500;
}

.job-company a {
    color: inherit;
    text-decoration: none;
}

.job-company a:hover {
    text-decoration: underline;
}

.job-company::before {
    content: "at ";
    color: var(--color-light);
    font-weight: 400;
}

.job-location {
    font-size: var(--font-size-sm);
    color: var(--color-light);
}

.job-location::before {
    content: "| ";
}

.job-date {
    font-size: var(--font-size-sm);
    color: var(--color-light);
    white-space: nowrap;
    flex-shrink: 0;
}

.job-achievements {
    list-style: none;
    padding-left: 0;
}

.job-achievements li {
    position: relative;
    padding-left: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    line-height: 1.5;
}

.job-achievements li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 4px;
    height: 4px;
    background: var(--color-accent);
    border-radius: 50%;
}

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

.job-achievements a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}

.job-achievements a:hover {
    text-decoration: underline;
}

/* ========================================
   Education Section
   ======================================== */

.education-item {
    margin-bottom: var(--spacing-md);
}

.education-item:last-child {
    margin-bottom: 0;
}

.education-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--spacing-xs);
}

.degree {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

.education-date {
    font-size: var(--font-size-sm);
    color: var(--color-light);
}

.school {
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    margin: 0;
}

/* ========================================
   Certifications Section
   ======================================== */

.certifications-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.cert-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--spacing-xs) 0;
}

.cert-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-primary);
}

.cert-issuer {
    font-size: var(--font-size-sm);
    color: var(--color-light);
}

/* ========================================
   PDF / Print Styles
   ======================================== */

/* Hidden elements */
.pdf-hide {
    display: block;
}

.pdf-only {
    display: none;
}

/* PDF-specific styles when printing-pdf class is added */
body.printing-pdf .pdf-hide,
body.printing-pdf .chat-widget,
body.printing-pdf .footer,
body.printing-pdf .download-btn,
body.printing-pdf .header-left {
    display: none !important;
}

body.printing-pdf .pdf-only {
    display: block !important;
}

body.printing-pdf .contact-text {
    display: block !important;
}

body.printing-pdf .resume-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

body.printing-pdf .header-content {
    justify-content: flex-start;
}

body.printing-pdf .header-text {
    padding-top: 0;
}

body.printing-pdf .section {
    margin-bottom: var(--spacing-md);
}

body.printing-pdf .job {
    margin-bottom: var(--spacing-md);
}

body.printing-pdf .job-achievements li {
    margin-bottom: 2px;
}

/* Print media query */
@media print {
    .pdf-hide,
    .chat-widget,
    .footer {
        display: none !important;
    }

    .pdf-only,
    .contact-text {
        display: block !important;
    }

    .resume-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    .resume-container {
        margin: var(--spacing-sm);
        padding: var(--spacing-md);
    }

    .download-btn {
        position: static;
        margin-bottom: var(--spacing-md);
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-left {
        width: 100%;
    }

    .header-text {
        padding-top: 0;
        width: 100%;
        text-align: center;
    }

    .job-header {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .job-date {
        order: -1;
    }

    .education-header {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .cert-item {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
}

/* ========================================
   Chat Widget Styles (Web Only)
   ======================================== */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

#chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0059b3 0%, #004494 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 12px rgba(0, 89, 179, 0.3),
        0 0 0 0 rgba(0, 89, 179, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: pulse-glow 2.5s ease-in-out infinite;
}

#chat-toggle:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 20px rgba(0, 89, 179, 0.4),
        0 0 0 0 rgba(0, 89, 179, 0);
    animation: none;
}

#chat-toggle.hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
    animation: none;
}

#chat-toggle.visible {
    animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow:
            0 4px 12px rgba(0, 89, 179, 0.3),
            0 0 0 0 rgba(0, 89, 179, 0.4);
    }
    50% {
        box-shadow:
            0 4px 12px rgba(0, 89, 179, 0.3),
            0 0 0 8px rgba(0, 89, 179, 0);
    }
}

.chat-toggle-icon {
    font-size: 22px;
}

.chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    height: 520px;
    max-height: 75vh;
    background: var(--color-white);
    border-radius: 16px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 10px 20px rgba(0, 0, 0, 0.1),
        0 20px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.25s ease;
    z-index: 999;
}

.chat-container.hidden {
    opacity: 0;
    transform: translateY(24px);
    pointer-events: none;
}

.chat-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Chat Backdrop */
.chat-backdrop {
    display: none;
}

.chat-header {
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0059b3 0%, #004494 100%);
    border-radius: 16px 16px 0 0;
    position: relative;
}

.chat-drag-handle {
    display: none;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-header-text {
    display: flex;
    flex-direction: column;
}

.chat-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-white);
    line-height: 1.2;
}

.chat-subtitle {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.chat-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--color-white);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 8px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    background: var(--color-white);
}

.message {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 16px;
    max-width: 85%;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    animation: message-fade-in 0.3s ease;
}

@keyframes message-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    background: var(--color-bg);
    color: var(--color-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border-left: 3px solid var(--color-accent);
}

.message.user {
    background: linear-gradient(135deg, #0059b3 0%, #004494 100%);
    color: var(--color-white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.suggested-questions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

.suggestion {
    background: var(--color-white);
    color: var(--color-accent);
    border: 1.5px solid var(--color-accent);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion:hover {
    background: var(--color-accent);
    color: var(--color-white);
    transform: translateY(-1px);
}

.chat-input-container {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-white);
}

.input-wrapper {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    resize: none;
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--color-bg);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-white);
    box-shadow: 0 0 0 3px rgba(0, 89, 179, 0.1);
}

.chat-input::placeholder {
    color: var(--color-light);
}

.chat-send {
    background: linear-gradient(135deg, #0059b3 0%, #004494 100%);
    color: var(--color-white);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 89, 179, 0.3);
}

.chat-send:active {
    transform: scale(0.98);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.char-counter {
    display: block;
    text-align: right;
    font-size: var(--font-size-xs);
    color: var(--color-light);
    margin-top: var(--spacing-xs);
}

/* ========================================
   Footer Styles (Web Only)
   ======================================== */

.footer {
    text-align: center;
    padding: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--color-accent);
    text-decoration: none;
    font-size: var(--font-size-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.github-link:hover {
    background: rgba(0, 89, 179, 0.05);
}

.github-link svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Message Formatting (Chat)
   ======================================== */

.message.bot strong {
    color: var(--color-primary);
    font-weight: 600;
}

.message.bot ul {
    margin: var(--spacing-xs) 0;
    padding-left: var(--spacing-md);
}

.message.bot li {
    margin-bottom: var(--spacing-xs);
}

.message.thinking {
    font-style: italic;
    color: var(--color-light);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Mobile Chat Adjustments - Bottom Sheet */
@media (max-width: 480px) {
    /* Backdrop overlay */
    .chat-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .chat-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    /* Bottom sheet container */
    .chat-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 85vh;
        max-height: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        transform: translateY(100%);
        opacity: 1;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        z-index: 999;
    }

    .chat-container.hidden {
        transform: translateY(100%);
        opacity: 1;
        pointer-events: none;
    }

    .chat-container.visible {
        transform: translateY(0);
        opacity: 1;
    }

    /* Drag handle indicator */
    .chat-drag-handle {
        display: block;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--color-border);
        border-radius: 2px;
    }

    /* Chat header adjustments for mobile bottom sheet */
    .chat-header {
        padding: var(--spacing-md);
        padding-top: calc(var(--spacing-md) + 12px);
        border-radius: 20px 20px 0 0;
        background: linear-gradient(135deg, #0059b3 0%, #004494 100%);
    }

    .chat-avatar {
        width: 32px;
        height: 32px;
    }

    .chat-title {
        font-size: var(--font-size-base);
        color: var(--color-white);
    }

    .chat-subtitle {
        font-size: var(--font-size-xs);
        color: rgba(255, 255, 255, 0.8);
    }

    .chat-close {
        padding: var(--spacing-sm);
        background: rgba(255, 255, 255, 0.1);
        color: var(--color-white);
    }

    .chat-close svg {
        width: 24px;
        height: 24px;
    }

    /* Input area with safe area padding */
    .chat-input-container {
        padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom, 0px));
    }

    .resume-container {
        padding-bottom: 80px;
    }
}
