@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&display=swap');

:root {
    --primary: #ff8fab;
    --secondary: #ffc3a0;
    --dark: #2c2c54;
    --light: #f5f5f5;
    --accent: #ff77a9;
    --danger: #ff4d6d;
    --success: #a8e6cf;
    --warning: #ffd3b6;
    --background: #000000;
    --overlay-color: rgba(0, 0, 0, 0.75);
    --indicator-success: #76c893;
    --indicator-warning: #ffd166;
    --indicator-error: #ff6b6b;
    --card-shadow: 0 4px 6px rgba(0,0,0,0.1);
    --gradient-overlay: linear-gradient(to bottom, rgba(0,0,0,0.4), transparent 30%, transparent 70%, rgba(0,0,0,0.4));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Playfair Display', serif;
    background: var(--background);
    color: var(--light);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

header h1 {
    font-size: 1.5rem;
    color: var(--light);
    margin: 0;
}

header p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.25rem;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.video-container {
    position: relative;
    flex: 1;
    background: var(--background);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#video, #output, #faceOverlay {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-overlay);
    pointer-events: none;
    z-index: 1;
}

.ai-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.ai-target {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    animation: scan 3s linear infinite;
}

.metrics-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    max-width: 220px;
    background: var(--overlay-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px;
    border-radius: 12px;
    color: white;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric {
    margin-bottom: 8px;
}

.metric:last-child {
    margin-bottom: 0;
}

.metric-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2px;
}

.progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 3px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease-out;
}

.sub-metrics {
    margin-top: 6px;
}

.sub-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.sub-metric:last-child {
    margin-bottom: 0;
}

.sub-label {
    color: rgba(255, 255, 255, 0.8);
}

.share-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.share-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.share-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.share-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.share-options {
    position: absolute;
    top: 50px;
    left: 0;
    background: var(--overlay-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.share-options.show {
    display: flex;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.controls {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn {
    min-width: 120px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: #ff3557;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #76c893;
}

.status {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--overlay-color);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: white;
    z-index: 100;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.beauty-metrics {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    margin: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.beauty-metrics h3 {
    font-size: 1.8rem;
    color: white;
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.beauty-score {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.beauty-score div {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.beauty-score h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.beauty-score p {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
    color: var(--accent);
}

.beauty-metrics p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 15px 0 5px 0;
}

.loading {
    position: fixed;
    inset: 0;
    background: var(--background);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: var(--accent);
    font-size: 1.2rem;
}

.final-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 20px;
}

.final-popup-content {
    background: var(--overlay-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    max-width: 90%;
    width: 400px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

.final-popup-content h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.final-popup-content img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.final-metrics {
    font-size: 0.9rem;
    text-align: left;
    margin-bottom: 20px;
}

.final-metric {
    margin-bottom: 10px;
}

.final-metric span:first-child {
    display: inline-block;
    width: 130px;
    color: rgba(255,255,255,0.9);
}

.final-metric span:last-child {
    float: right;
    color: var(--accent);
}

.final-progress-bar-container {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    height: 5px;
    margin-top: 5px;
    overflow: hidden;
    clear: both;
}

.final-progress-bar {
    background: var(--accent);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.popup-share-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

@keyframes scan {
    0% { top: 0%; }
    100% { top: 100%; }
}

@media screen and (max-width: 768px) {
    .control-group {
        flex-direction: column;
    }
    .btn {
        width: 100%;
    }
    .metrics-overlay {
        transform: scale(0.85);
        max-width: 160px;
    }
    .final-popup-content {
        width: 100%;
        max-width: none;
    }
    .beauty-metrics {
        margin: 10px;
        padding: 15px;
    }
    .beauty-score {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .beauty-score div {
        padding: 15px;
    }
    .beauty-score h4 {
        font-size: 1rem;
    }
    .beauty-score p {
        font-size: 1.5rem;
    }
    .beauty-metrics h3 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
}

@media screen and (min-width: 1200px) {
    .beauty-metrics {
        margin: 30px auto;
        max-width: 1200px;
        padding: 30px;
    }
    .beauty-score p {
        font-size: 2.5rem;
    }
}
