/* main.css - Spotify Redesign */

:root {
    --spotify-green: #1db954;
    --spotify-black: #121212;
    --spotify-dark-gray: #212121;
    --spotify-light-gray: #b3b3b3;
    --spotify-white: #ffffff;
    --spotify-light-black: #181818;
    --spotify-highlight: #1ed760;
    --primary-color: var(--spotify-green);
    --primary-hover: #1ed760;
    --secondary-color: var(--spotify-light-gray);
    --light-bg: var(--spotify-light-black);
    --dark-bg: var(--spotify-black);
    --border-color: #333333;
    --text-color: var(--spotify-white);
    --light-text: var(--spotify-white);
    --success-color: var(--spotify-green);
    --danger-color: #e91429;
    --warning-color: #ffa42b;
    --info-color: #2e77d0;
}

@font-face {
    font-family: 'Spotify Circular';
    src: url('https://open.scdn.co/fonts/CircularSpUIv3T-Book.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Spotify Circular';
    src: url('https://open.scdn.co/fonts/CircularSpUIv3T-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Spotify Circular', 'Circular', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--spotify-black);
    letter-spacing: -0.02em;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header styles */
header {
    padding: 20px 0;
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.4rem;
    color: var(--spotify-green);
    margin-bottom: 5px;
    font-weight: 900;
    line-height: 1.1;
    max-width: 100%;
    overflow-wrap: break-word;
}

header .tagline {
    font-size: 1.2rem;
    color: var(--spotify-light-gray);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.app-header h1 {
    margin-bottom: 0;
    font-size: 1.8rem;
    white-space: nowrap;
}

nav ul {
    list-style-type: none;
    display: flex;
    gap: 20px;
}

nav ul li a {
    text-decoration: none;
    color: var(--spotify-light-gray);
    font-weight: 700;
    padding: 5px 10px;
    transition: all 0.2s ease;
}

nav ul li a:hover, nav ul li a.active {
    color: var(--spotify-green);
}

nav ul li a.active {
    border-bottom: 2px solid var(--spotify-green);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#security-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    font-size: 14px;
}

#security-status.security-active {
    background: rgba(29, 185, 84, 0.2);
    color: var(--spotify-green);
}

#video, #canvas {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    background-color: var(--spotify-black);
    display: block;
    margin: 0 auto;
}
  
.camera-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Card styles */
.card {
    background-color: var(--spotify-light-black);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
    transition: transform 0.2s ease;
}

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

/* Button styles */
.btn {
    display: inline-block;
    font-weight: 700;
    text-align: center;
    padding: 12px 32px;
    border-radius: 500px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #666666 !important;
    box-shadow: none !important;
    transform: none !important;
}

.btn-primary {
    background-color: var(--spotify-green);
    color: var(--spotify-black);
}

.btn-primary:hover {
    background-color: var(--spotify-highlight);
    transform: scale(1.04);
}

.btn-secondary {
    background-color: transparent;
    color: var(--spotify-white);
    border: 1px solid var(--spotify-light-gray);
}

.btn-secondary:hover {
    border-color: var(--spotify-white);
    background-color: rgba(255, 255, 255, 0.1);
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--spotify-light-gray);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-button:hover {
    color: var(--spotify-white);
    transform: scale(1.1);
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--spotify-light-gray);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: #333;
    color: var(--spotify-white);
    font-family: 'Spotify Circular', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: var(--spotify-green);
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.25);
}

/* Registration steps */
.registration-step {
    display: none;
}

.registration-step.active {
    display: block;
}

.registration-step h3 {
    margin-bottom: 15px;
    font-weight: 900;
    color: var(--spotify-white);
}

.instructions {
    margin-bottom: 20px;
    color: var(--spotify-light-gray);
}

/* Webcam container */
.webcam-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    overflow: hidden;
    border-radius: 8px;
    background-color: var(--spotify-black);
    aspect-ratio: 4/3;
}

#registration-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
}

#face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.face-guide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-outline {
    width: 200px;
    height: 280px; /* Plus haut que large pour former un ovale */
    border: 2px dashed var(--spotify-green);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); /* Assombrissement autour de l'ovale */
    position: relative;
}

/* Effet lorsque le visage est correctement positionné */
.face-detected .face-outline {
    border: 3px solid var(--spotify-green);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6), 0 0 20px rgba(29, 185, 84, 0.5);
    animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
    0% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6), 0 0 10px rgba(29, 185, 84, 0.5); }
    50% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6), 0 0 20px rgba(29, 185, 84, 0.8); }
    100% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6), 0 0 10px rgba(29, 185, 84, 0.5); }
}

.capture-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 210px; /* Plus haut que large pour forme ovale */
    border: 2px dashed var(--spotify-green);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
}

/* Nouvelle classe pour l'ovale de capture */
.face-guide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    background-color: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.face-guide-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 280px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--spotify-green);
}

#capture-status {
    text-align: center;
    margin-bottom: 15px;
    font-weight: 700;
    color: var(--spotify-light-gray);
}

.controls {
    text-align: center;
    margin: 20px 0;
}

.capture-helper {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--spotify-light-gray);
    font-style: italic;
}

.controls-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.reference-photo-container {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 20px auto;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--spotify-dark-gray);
}

#reference-photo {
    width: 100%;
    transform: scaleX(-1); /* Mirror effect */
}

/* Success icon */
.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px auto;
    background-color: var(--spotify-green);
    color: var(--spotify-black);
    font-size: 40px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#verification-video {
    position: fixed;
    width: 1px;
    height: 1px;
    top: 0;
    left: 0;
    opacity: 0.01;
    pointer-events: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-dialog {
    background-color: var(--spotify-light-black);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(233, 20, 41, 0.1);
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.hidden {
    display: none;
}

/* Home page */
.welcome-card {
    text-align: center;
    max-width: 800px;
}

.welcome-card h2 {
    margin-bottom: 15px;
    color: var(--spotify-green);
    font-weight: 900;
    font-size: 2.2rem;
}

.features {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    margin: 30px 0;
}

.feature {
    flex: 1;
    min-width: 240px;
    padding: 24px;
    border-radius: 8px;
    background-color: var(--spotify-dark-gray);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.feature:hover {
    transform: translateY(-5px);
    background-color: #2a2a2a;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--spotify-green);
}

.action-buttons {
    margin-top: 30px;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }

    header h1 {
        font-size: 2.2rem;
    }

    .btn {
        padding: 10px 24px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 540px;
    }

    header h1 {
        font-size: 1.8rem;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 20px;
    }

    .feature {
        min-width: 200px;
    }

    .features {
        gap: 15px;
    }

    .controls-row {
        flex-direction: column;
        gap: 15px;
    }

    .controls-row .btn {
        width: 100%;
    }
    
    /* Navigation responsive */
    .app-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 576px) {
    .container {
        max-width: 100%;
        padding: 0 10px;
    }

    header {
        padding: 15px 0;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 15px;
        border-radius: 6px;
    }

    .feature {
        min-width: 100%;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .face-outline,
    .capture-circle {
        width: 150px;
        height: 150px;
    }
}