/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #334155;
    background-color: #ffffff;
    overflow-x: hidden;
}

/* Prevent horizontal overflow on small devices */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Ensure media elements can't exceed the viewport width */
img, svg, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Make sure key containers respect box-sizing and viewport width */
.container, .nav-container, .hero-container, .modal, .carousel, .projects-grid {
    box-sizing: border-box;
    max-width: 100vw;
}

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors */
    --primary-color: #2563eb;
    --secondary-color: #1e293b;
    --accent-color: #06b6d4;
    --text-color: #334155;
    --text-light: #64748b;
    --bg-color: #ffffff;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    --spacing-3xl: 6rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* ===== UTILITY CLASSES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: var(--font-size-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: var(--shadow-medium);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-3xl);
}

.section-title {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.section-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity var(--transition-slow);
}

.loader {
    text-align: center;
}

.loader-text {
    font-size: var(--font-size-lg);
    color: var(--primary-color);
    margin-top: var(--spacing-sm);
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all var(--transition-normal);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-medium);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

/* Ajuste para evitar que a imagem de perfil seja cortada pelo navbar */
.hero {
    padding-top: 110px; /* espaço para navbar */
}

.nav-logo a {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--secondary-color);
    transition: all var(--transition-normal);
    border-radius: 2px;
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23e2e8f0" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.5;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
    position: relative;
    z-index: 1;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

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

.profile-img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid white;
    box-shadow: var(--shadow-heavy);
    transition: transform var(--transition-normal);
    display: block;
    margin: 20px auto 1rem auto;
}

.profile-img:hover {
    transform: scale(1.05);
}

.hero-title {
    font-size: var(--font-size-5xl);
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: var(--font-size-2xl);
    color: var(--primary-color);
    margin-bottom: var(--spacing-lg);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-description {
    font-size: var(--font-size-lg);
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.hero-social {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.hero-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: white;
    color: var(--text-color);
    border-radius: 50%;
    text-decoration: none;
    box-shadow: var(--shadow-medium);
    transition: all var(--transition-normal);
}

.hero-social a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translate(-50%, 0);
    animation: bounce 2s infinite;
    max-width: 100%;
}

/* Prevent absolute centered elements from creating horizontal scroll due to transforms */
[class*="-indicator"], [class*="-arrow"], [class*="-img-container"] {
    max-width: 100%;
    box-sizing: border-box;
}

.scroll-arrow {
    width: 30px;
    height: 30px;
    border: 2px solid var(--primary-color);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* ===== ABOUT SECTION ===== */
.about {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-color);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: center;
    }

    @media (max-width: 768px) {
        .about-content {
            display: grid;
            grid-template-columns: 1fr;
            gap: var(--spacing-lg);
            align-items: start;
        }

        /* garantir que o texto apareça antes da imagem em dispositivos móveis */
        .about-text {
            order: 1;
        }

        .about-image {
            order: 2;
        }

        .about-img-container img {
            height: 220px; /* ainda menor em mobile */
        }
    }

.about-text p {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
    line-height: 1.7;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
}

.stat {
    text-align: center;
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    transition: transform var(--transition-normal);
}

.stat:hover {
    transform: translateY(-5px);
}

.stat-number {
    display: block;
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    font-weight: 500;
}

.about-image {
    position: relative;
}

.about-img-container {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-heavy);
}

.about-img-container img {
    width: 100%;
    height: 300px; /* menor por padrão */
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.about-img-container:hover img {
    transform: scale(1.05);
}

/* ===== SKILLS SECTION ===== */
.skills {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-light);
}

.skills-content {
    display: grid;
    gap: var(--spacing-2xl);
}

.skills-category {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-medium);
    transition: transform var(--transition-normal);
}

.skills-category:hover {
    transform: translateY(-5px);
}

.category-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.skill-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.skill-item i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
    transition: color var(--transition-normal);
}

.skill-item:hover i {
    color: white;
}

.skill-item span {
    font-weight: 500;
    font-size: var(--font-size-sm);
}

/* ===== PROJECTS SECTION ===== */
.projects {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-color);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
}

.project-card {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    transition: all var(--transition-normal);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.project-image {
    position: relative;
    overflow: hidden;
    height: 250px;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(37, 99, 235, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

.project-links {
    display: flex;
    gap: var(--spacing-md);
}

.project-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.project-link:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

.project-content {
    padding: var(--spacing-lg);
}

.project-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
}

.project-description {
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.tech-tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-light);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.projects-cta {
    text-align: center;
}

/* ===== CONTACT SECTION ===== */
.contact {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-light);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: start;
}

.contact-info h3 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-md);
}

.contact-info p {
    font-size: var(--font-size-lg);
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
    line-height: 1.7;
}

.contact-details {
    margin-bottom: var(--spacing-xl);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.contact-item i {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: var(--font-size-lg);
}

.contact-item h4 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.contact-item p {
    color: var(--text-light);
    margin: 0;
}

.contact-social {
    display: flex;
    gap: var(--spacing-md);
}

.contact-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.contact-social a:hover {
    background: var(--accent-color);
    transform: translateY(-3px);
}

.contact-form {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-medium);
}

.form-group {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all var(--transition-normal);
    background: transparent;
}

.form-group input[type="tel"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
}

.field-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: var(--text-light);
    font-size: var(--font-size-base);
    pointer-events: none;
    transition: all var(--transition-normal);
}

.form-group input:focus + label,
.form-group input:valid + label,
.form-group textarea:focus + label,
.form-group textarea:valid + label {
    top: -0.5rem;
    left: 0.75rem;
    font-size: var(--font-size-sm);
    color: var(--primary-color);
    background: white;
    padding: 0 0.5rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--secondary-color);
    color: white;
    padding: var(--spacing-2xl) 0 var(--spacing-lg);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-info h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-xs);
}

.footer-info p {
    color: #94a3b8;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: white;
}

.footer-social {
    display: flex;
    gap: var(--spacing-md);
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.footer-social a:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-color);
    transform: translateY(-3px);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .hero-title {
        font-size: var(--font-size-4xl);
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }
    
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        right: 0;
        left: 0;
        transform: translateX(-100%);
        will-change: transform;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-medium);
        padding: var(--spacing-lg) 0;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
    }
    
    .hero-subtitle {
        font-size: var(--font-size-xl);
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .section-title {
        font-size: var(--font-size-3xl);
    }
    
    .about-stats {
        grid-template-columns: 1fr;
    }
    
    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .hero-title {
        font-size: var(--font-size-2xl);
    }
    
    .profile-img {
        width: 150px;
        height: 150px;
    }
    
    .section-title {
        font-size: var(--font-size-2xl);
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .project-card {
        margin: 0;
        box-sizing: border-box;
        width: auto;
    }

    /* Ajuste botão voltar ao topo em mobile */
    .back-to-top {
        left: 16px;
        bottom: 16px;
        width: 48px;
        height: 48px;
    }
}

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

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

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

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== CERTIFICATES MODAL & CAROUSEL ===== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px) saturate(120%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.modal.show {
    display: flex;
}

/* Card centralizado e moderno */
.modal-content {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    width: 100%;
    max-width: 920px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(2,6,23,0.35);
    overflow: hidden;
    position: relative;
    transform: translateY(0) scale(0.98);
    opacity: 0;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
}

/* Ensure modal content never exceeds viewport on small screens (account for padding) */
@media (max-width: 767px) {
    .modal-content {
        max-width: calc(100% - 24px);
    }
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(15,23,42,0.06);
}

.modal-body {
    padding: 1rem;
    max-height: calc(80vh - 72px);
    overflow: auto;
}

.carousel-container {
    position: relative;
    overflow: hidden;
}

.carousel {
    display: flex;
    transition: transform 0.4s ease;
    width: 100%;
}

.carousel-item {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-item img {
    max-width: 100%;
    max-height: calc(80vh - 160px);
    height: auto;
    object-fit: contain;
    cursor: zoom-in;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(2,6,23,0.6);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

.carousel-indicators {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.indicator {
    width: 10px;
    height: 10px;
    background: var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
}

.indicator.active {
    background: var(--primary-color);
    transform: scale(1.15);
}

/* Mobile: modal behaves like bottom sheet but still modern */
@media (max-width: 767px) {
    .modal {
        align-items: flex-end;
        padding: 12px;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 92vh;
        transform: translateY(8px) scale(0.995);
    }

    .modal.show .modal-content {
        transform: translateY(0) scale(1);
    }

    .carousel-item img {
        max-height: calc(70vh - 120px);
    }
}


/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #000000;
        --text-color: #000000;
        --bg-color: #ffffff;
    }
}

