/* CSS Custom Properties for Theme Switching */
:root {
    /* Dark theme (default) */
    --bg-primary: #0f1419;
    --bg-secondary: #1a202c;
    --bg-tertiary: #2d3748;
    --bg-card: #1a202c;
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e0;
    --border-color: #2d3748;
    --nav-bg: rgba(0, 0, 0, 0);
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] {
    /* Light theme */
    --bg-primary: #f1f5f9;
    --bg-secondary: #e2e8f0;
    --bg-tertiary: #cbd5e0;
    --bg-card: #f1f5f9;
    --text-primary: #1a202c;
    --text-secondary: #2d3748;
    --text-muted: #4a5568;
    --border-color: #cbd5e0;
    --nav-bg: rgba(0, 0, 0, 0);
    --shadow: rgba(0, 0, 0, 0.08);
}

/* Light mode specific card backgrounds */
[data-theme="light"] .skill-card {
    background: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .cert-card,
[data-theme="light"] .education-card,
[data-theme="light"] .training-section {
    background: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .job-card {
    background: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .skill-card:hover {
    background: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .cert-card:hover,
[data-theme="light"] .education-card:hover,
[data-theme="light"] .training-section:hover {
    background: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .job-card:hover {
    background: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .job-card:hover .job-header {
    background: #f1f5f9;
}

/* Dark mode job header hover effect */
[data-theme="dark"] .job-card:hover .job-header {
    background: #374151;
}

/* Dark mode specific card backgrounds */
[data-theme="dark"] .skill-card {
    background: #2d3748;
}

[data-theme="dark"] .skill-card:hover {
    background: #374151;
}

/* Dark mode specific button text colors on hover */
[data-theme="dark"] .contact-link:hover,
[data-theme="dark"] .contact-section .contact-link:hover {
    color: #1a202c;
}

[data-theme="dark"] .cert-button:hover .cert-text {
    color: #1a202c;
}

[data-theme="dark"] .cert-button:hover .cert-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a202c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3Cpath d='M16 13H8'/%3E%3Cpath d='M16 17H8'/%3E%3Cpath d='M10 9H8'/%3E%3C/svg%3E");
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

[data-theme="dark"] .theme-toggle:hover .theme-text {
    color: var(--text-primary);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 0 2rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.theme-toggle:hover {
    border-color: var(--text-muted);
    background: var(--bg-secondary);
}

.theme-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.theme-toggle:hover .theme-text {
    color: var(--text-primary);
}

/* Navigation Right Container */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    position: relative;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Main content */
.main-content {
    padding-top: 80px; /* Account for fixed nav */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    padding: 4rem 0 6rem 0;
    text-align: center;
    background-color: var(--bg-primary);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-contact {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.contact-link:hover {
    background: var(--text-muted);
    color: #ffffff;
    transform: translateY(-2px);
}

.pdf-button {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.pdf-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section:nth-child(even) {
    background-color: var(--bg-secondary);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3rem;
    text-align: center;
}

/* Profile Section */
.profile-text {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

.profile-text p {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
    text-align: left;
    margin-bottom: 1.5rem;
}

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

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.skill-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.skill-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--text-muted);
}

.skill-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.skill-years {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Experience Section */
.job-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.job-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--text-muted);
}

.job-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.job-company {
    color: var(--text-muted);
    font-style: italic;
}

.job-period {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.job-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem 0;
}

.job-content h4:first-child {
    margin-top: 0;
}

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

.job-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-muted);
    line-height: 1.6;
}

.job-list li::before {
    content: '■';
    position: absolute;
    left: 0;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 0.8rem;
}

/* Education Section */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.education-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.education-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--text-muted);
}

.education-card-content {
    flex: 1;
}

.education-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.education-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cert-button {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 80px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    gap: 4px;
}

.cert-button:hover {
    background: var(--text-muted);
    border-color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.cert-icon {
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3Cpath d='M16 13H8'/%3E%3Cpath d='M16 17H8'/%3E%3Cpath d='M10 9H8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.cert-button:hover .cert-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3Cpath d='M16 13H8'/%3E%3Cpath d='M16 17H8'/%3E%3Cpath d='M10 9H8'/%3E%3C/svg%3E");
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.cert-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    transition: color 0.3s ease;
}

.cert-button:hover .cert-text {
    color: #ffffff;
}

.training-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.training-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--text-muted);
}

.training-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.training-section p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Contact Section */
.contact-section {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.contact-section .section-title {
    color: var(--text-primary);
}

.contact-text {
    text-align: center;
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-links {
    text-align: center;
}

.contact-section .contact-link {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.contact-section .contact-link:hover {
    background: var(--text-muted);
    color: #ffffff;
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-info span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.contact-info .phone-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.contact-info .phone-link:hover,
.contact-info .phone-link:focus {
    color: var(--text-primary);
    text-decoration: underline;
}

.contact-info .address-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.contact-info .address-link:hover,
.contact-info .address-link:focus {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 950px) {
    .nav-container {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 1rem;
        align-items: center;
    }
    
    .nav-logo {
        grid-column: 1;
        grid-row: 1;
    }
    
    .theme-toggle {
        grid-column: 2;
        grid-row: 1;
    }
    
    .nav-links {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .section {
        padding: 2.5rem 0;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .job-card {
        padding: 1.5rem;
    }
    
    .job-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .education-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .hero-contact {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 0 3rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    /* Mobile Navigation */
    .hamburger {
        display: flex;
    }
    
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 1rem;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 2px 10px var(--shadow);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links a {
        padding: 0.75rem 0;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .skill-card,
    .job-card,
    .education-card,
    .training-section {
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar {
        display: none;
    }
    
    .main-content {
        padding-top: 0;
    }
    
    body {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .hero {
        padding: 1rem 0;
        page-break-after: avoid;
    }
    
    .section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    .job-card {
        page-break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .skill-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .contact-section {
        background: white;
        color: #333;
    }
    
    .contact-section .section-title {
        color: #333;
    }
    
    .contact-text {
        color: #666;
    }
    
    .contact-info span {
        color: #666;
    }
    
    .skill-card {
        background: white;
        border: 1px solid #ccc;
    }
    
    .job-card {
        background: white;
        border: 1px solid #ccc;
    }
    
    .education-card,
    .training-section {
        background: white;
        border: 1px solid #ccc;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background-color: var(--bg-primary);
    margin: 2% auto;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    height: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: var(--text-muted);
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    background: var(--bg-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover,
.close:focus {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.modal-body {
    padding: 20px;
    height: calc(100% - 40px);
}

#certViewer {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 6px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        height: 85%;
        margin: 5% auto;
    }
    
    .modal-body {
        padding: 5px;
    }
    
    .close {
        top: 5px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
    
    #certViewer {
        transform: scale(0.8);
        transform-origin: top left;
        width: 125%;
        height: 125%;
    }
    
    /* Scale down certificate buttons on smaller screens */
    .cert-button {
        width: 60px;
        height: 45px;
        gap: 2px;
    }
    
    .cert-icon {
        width: 18px;
        height: 18px;
    }
    
    .cert-button:hover .cert-icon {
        width: 18px;
        height: 18px;
    }
    
    [data-theme="dark"] .cert-button:hover .cert-icon {
        width: 18px;
        height: 18px;
    }
    
    .cert-text {
        font-size: 0.6rem;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .modal-content {
        width: 100%;
        height: 90%;
        margin: 2% auto;
        border-radius: 0;
    }
    
    .modal-body {
        padding: 2px;
    }
    
    .close {
        top: 2px;
        right: 5px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
    
    #certViewer {
        transform: scale(0.6);
        transform-origin: top left;
        width: 167%;
        height: 167%;
    }
    
    .cert-button {
        width: 50px;
        height: 38px;
        gap: 1px;
    }
    
    .cert-icon {
        width: 16px;
        height: 16px;
    }
    
    .cert-button:hover .cert-icon {
        width: 16px;
        height: 16px;
    }
    
    [data-theme="dark"] .cert-button:hover .cert-icon {
        width: 16px;
        height: 16px;
    }
    
    .cert-text {
        font-size: 0.55rem;
    }
}

/* Print and PDF specific styles */
@media print {
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .job-card {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .section {
        page-break-after: avoid;
        break-after: avoid;
    }
    
    .skill-card, .education-card, .cert-card {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    .job-list {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    .navbar {
        display: none !important;
    }
}