/* ============================================================================
   NETFLIX CLONE - MINIMALISTA & ELEGANTE
   Design limpo, moderno e sofisticado
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========== VARIÁVEIS CSS (ROOT) ========== */
:root[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --text-color: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-color: #e50914;
    --accent-hover: #f81c15;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --transition: 200ms ease-out;
}

:root[data-theme="light"] {
    --bg-primary: #fafafa;
    --text-color: #1a1a1a;
    --text-secondary: #666666;
    --accent-color: #e50914;
    --accent-hover: #c40812;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --border-color: rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: 200ms ease-out;
}

/* ========== RESET & GLOBAIS ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-primary);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== BOTÃO TOGGLE DE TEMA ========== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 100;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.theme-toggle:active {
    transform: translateY(0);
}

/* ========== LAYOUT PRINCIPAL ========== */
main {
    width: 100%;
    max-width: 900px;
    padding: 60px 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ========== TÍTULO PRINCIPAL ========== */
h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 60px;
    text-transform: capitalize;
    letter-spacing: -0.5px;
    color: var(--text-color);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== CONTAINER DE PERFIS ========== */
.profiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 30px;
    justify-content: center;
    max-width: 700px;
    margin: 0 auto 60px;
    list-style: none;
    padding: 0 20px;
}

/* ========== CARD DO PERFIL ========== */
.profile {
    cursor: pointer;
    transition: all var(--transition);
    animation: slideIn 0.5s ease-out;
    position: relative;
    border-radius: 6px;
    will-change: transform;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile:nth-child(1) { animation-delay: 80ms; }
.profile:nth-child(2) { animation-delay: 120ms; }
.profile:nth-child(3) { animation-delay: 160ms; }
.profile:nth-child(4) { animation-delay: 200ms; }

.profile:hover {
    transform: scale(1.1) translateY(-10px);
    z-index: 10;
}

/* ========== FIGURA DO PERFIL ========== */
figure {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    margin: 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    aspect-ratio: 9 / 10;
    transition: all var(--transition);
}

.profile:hover figure {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

/* ========== IMAGEM DO PERFIL ========== */
.profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all var(--transition);
    filter: brightness(0.9);
}

.profile:hover img {
    transform: scale(1.08);
    filter: brightness(1);
}

/* ========== LEGENDA DO PERFIL ========== */
figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0) 100%);
    color: #fff;
    padding: 35px 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-align: center;
    transform: translateY(0);
    transition: all var(--transition);
    text-transform: capitalize;
}

.profile:hover figcaption {
    transform: translateY(-4px);
}

:root[data-theme="light"] figcaption {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 100%);
    color: #1a1a1a;
}

/* ========== LINK DO PERFIL ========== */
.profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    height: 100%;
}

.profile-link:focus {
    outline: none;
}

/* ========== HEADER COM LOGO ========== */
.header-profiles {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 0 40px;
    position: relative;
    z-index: 1;
    gap: 20px;
    animation: fadeIn 0.6s ease-out;
}

.netflix-logo {
    height: 40px;
    width: auto;
    transition: all var(--transition);
}

.netflix-logo:hover {
    transform: scale(1.02);
}

/* ========== BOTÃO GERENCIAR PERFIS ========== */
.edit-mode-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.edit-mode-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.edit-mode-btn:active {
    transform: translateY(0);
}

.edit-mode-btn.active {
    background: var(--success-color);
}

/* ========== BOTÃO ADICIONAR PERFIL ========== */
.add-profile-btn {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: all var(--transition);
    animation: slideIn 0.5s ease-out 240ms backwards;
    margin: 0 auto;
}

.profile-add {
    width: 110px;
    height: 125px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.add-profile-btn:hover .profile-add {
    border-color: var(--accent-color);
    background: transparent;
    transform: scale(1.05);
    color: var(--accent-color);
    box-shadow: var(--shadow);
}

.add-profile-btn span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

/* ========== BOTÃO EDITAR PERFIL ========== */
.btn-editar-perfil {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.profile:hover .btn-editar-perfil {
    opacity: 1;
    transform: scale(1);
}

.btn-editar-perfil:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);\n    animation: fadeIn 0.3s ease-out;
}\n\n.modal-content {\n    background: var(--bg-secondary);\n    padding: 40px;\n    border-radius: 12px;\n    max-width: 500px;\n    width: 90%;\n    position: relative;\n    box-shadow: var(--shadow-lg);\n    animation: slideInUp 0.3s ease-out;\n    border: 1px solid var(--border-color);\n}\n\n@keyframes slideInUp {\n    from {\n        opacity: 0;\n        transform: translateY(30px);\n    }\n    to {\n        opacity: 1;\n        transform: translateY(0);\n    }\n}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--accent-color);
    transform: rotate(90deg);
}

.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--accent-color);
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-section {
    margin-bottom: 30px;
}

.modal-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-color);
    letter-spacing: 0.3px;
}

/* ========== SELEÇÃO DE AVATARES ========== */
.avatar-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.avatar-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all var(--transition);
    box-shadow: var(--shadow);
    aspect-ratio: 1;
}

.avatar-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all var(--transition);
}

.avatar-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
}

.avatar-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-color);
}

.avatar-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: var(--accent-color);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    opacity: 0;
    transform: scale(0.7);
    transition: all var(--transition);
}

.avatar-item.selected .avatar-check {
    opacity: 1;
    transform: scale(1);
}

/* ========== INPUT DE NOME ========== */
#perfil-nome {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-color);
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
}

#perfil-nome::placeholder {
    color: var(--text-secondary);
}

#perfil-nome:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
}

/* ========== BOTÕES DO MODAL ========== */
.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.3px;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.btn-danger {
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    flex: 0 0 auto;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ========== RESPONSIVIDADE ========== */

@media (max-width: 768px) {
    main {
        padding: 40px 20px;
    }

    h1 {
        margin-bottom: 50px;
    }

    .header-profiles {
        padding: 0 0 35px;
        flex-direction: column;
        gap: 15px;
    }

    .netflix-logo {
        height: 35px;
    }

    .edit-mode-btn {
        width: 100%;
    }

    .profiles {
        gap: 25px;
        max-width: 600px;
    }

    .modal-content {
        padding: 30px 25px;
        max-width: 90%;
        width: 100%;
    }

    .avatar-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .btn-danger {
        display: none;
    }
}

@media (max-width: 480px) {
    main {
        padding: 30px 16px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 40px;
    }

    .profiles {
        gap: 20px;
        grid-template-columns: repeat(2, 1fr);
    }

    .theme-toggle {
        padding: 8px 12px;
        font-size: 1rem;
    }

    .modal-content {
        padding: 24px 20px;
        border-radius: 10px;
    }

    .modal-close {
        top: 12px;
        right: 12px;
    }

    .modal h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    .modal-section {
        margin-bottom: 20px;
    }

    #perfil-nome {
        padding: 12px 14px;
        font-size: 1rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .add-profile-btn span {
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 1.3rem;
        letter-spacing: -0.5px;
    }

    .profiles {
        gap: 15px;
        grid-template-columns: 1fr 1fr;
    }

    .header-profiles {
        flex-direction: column;
        gap: 15px;
    }

    .profile-add {
        font-size: 2.5rem;
    }
}