/* ==========================================================================
   AI OUTFIT COLOR HARMONIZER - STYLE SYSTEM
   Palet Warna: Warm Earth-Tone (Kayu Hangat, Sage/Zaitun, Terracotta & Sand Cream)
   ========================================================================== */

:root {
    /* Palet Warna Alami & Earth Tone */
    --color-bg-primary: #f8f4ee;
    --color-bg-secondary: #f0e7dc;
    --color-surface: rgba(255, 255, 255, 0.78);
    --color-surface-hover: rgba(255, 255, 255, 0.92);
    --color-border: rgba(180, 150, 120, 0.22);
    --color-border-focus: rgba(140, 95, 60, 0.45);

    /* Tone Aksen */
    --color-wood-dark: #2c1e16;
    --color-wood-medium: #5d4332;
    --color-wood-light: #8e6a4f;
    --color-terracotta: #c86432;
    --color-terracotta-glow: rgba(200, 100, 50, 0.25);
    --color-sage: #4f6b55;
    --color-sage-light: #7b9982;
    --color-sage-bg: #eaf1eb;
    --color-gold: #c9933b;

    /* Status Warna */
    --color-success: #3c7a4b;
    --color-success-bg: #e8f5ec;
    --color-warning: #c27803;
    --color-danger: #b33939;
    --color-danger-bg: #fde8e8;

    /* Tipografi */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Shadow & Glass */
    --shadow-sm: 0 4px 12px rgba(60, 40, 25, 0.05);
    --shadow-md: 0 10px 30px rgba(60, 40, 25, 0.08);
    --shadow-lg: 0 20px 45px rgba(60, 40, 25, 0.12);
    --glass-blur: blur(14px);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Transisi */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.18s ease-in-out;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-primary);
    color: var(--color-wood-dark);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 15% 15%, rgba(200, 100, 50, 0.08) 0px, transparent 50%),
        radial-gradient(at 85% 20%, rgba(79, 107, 85, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 80%, rgba(142, 106, 79, 0.09) 0px, transparent 60%);
}

/* Background Ambient Elements */
.bg-blur-circle {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}
.circle-1 {
    width: 380px;
    height: 380px;
    background: rgba(217, 119, 54, 0.12);
    top: -80px;
    left: -80px;
}
.circle-2 {
    width: 440px;
    height: 440px;
    background: rgba(79, 107, 85, 0.15);
    bottom: -100px;
    right: -100px;
}
.circle-3 {
    width: 320px;
    height: 320px;
    background: rgba(201, 147, 59, 0.1);
    top: 45%;
    left: 65%;
}

/* Main Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* App Header */
.app-header {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--color-sage-bg);
    color: var(--color-sage);
    border: 1px solid rgba(79, 107, 85, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-tag i {
    color: var(--color-gold);
}

.main-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4.5vw, 2.9rem);
    font-weight: 800;
    color: var(--color-wood-dark);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.main-title span {
    background: linear-gradient(135deg, var(--color-terracotta), var(--color-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--color-wood-medium);
    max-width: 650px;
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 28px;
    align-items: start;
}

/* Glass Card Component */
.glass-card {
    background: var(--color-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--color-border-focus);
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.header-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-wood-medium), var(--color-wood-dark));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(44, 30, 22, 0.2);
}

.header-icon.icon-palette {
    background: linear-gradient(135deg, var(--color-sage), var(--color-sage-light));
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.28rem;
    font-weight: 700;
    color: var(--color-wood-dark);
}

.card-header p {
    font-size: 0.88rem;
    color: var(--color-wood-medium);
}

/* Viewport / Camera Box */
.viewport-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 400px;
    background: #181310;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.media-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-display canvas,
.media-display img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

/* Scanner Guide Overlay */
.scanner-guide {
    position: absolute;
    inset: 24px;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-sm);
    pointer-events: none;
    z-index: 5;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
}

.corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--color-gold);
    border-style: solid;
}
.corner-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-top-left-radius: 4px; }
.corner-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-top-right-radius: 4px; }
.corner-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-bottom-left-radius: 4px; }
.corner-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-bottom-right-radius: 4px; }

.guide-text {
    background: rgba(24, 19, 16, 0.7);
    backdrop-filter: blur(6px);
    color: #f3ece2;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Scanner Animated Laser */
.scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-terracotta), var(--color-gold), transparent);
    box-shadow: 0 0 12px var(--color-terracotta);
    z-index: 6;
    pointer-events: none;
    opacity: 0;
}

.scanner-laser.active {
    opacity: 1;
    animation: scanMove 2.2s ease-in-out infinite alternate;
}

@keyframes scanMove {
    0% { top: 8%; }
    100% { top: 90%; }
}

/* Camera Placeholder State */
.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
    color: #f3ece2;
    z-index: 4;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--color-gold);
    margin-bottom: 14px;
}

.camera-placeholder h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.camera-placeholder p {
    font-size: 0.85rem;
    color: #c7b8ad;
    max-width: 320px;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(24, 19, 16, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 20;
    color: #ffffff;
}

.custom-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--color-gold);
    border-right-color: var(--color-terracotta);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Control Buttons */
.control-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 22px;
    font-family: var(--font-heading);
    font-size: 0.96rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-smooth);
    user-select: none;
    text-decoration: none;
    flex: 1 1 auto;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-terracotta), #b45222);
    color: #ffffff;
    box-shadow: 0 4px 16px var(--color-terracotta-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 100, 50, 0.38);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--color-danger);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(179, 57, 57, 0.25);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: #9d2b2b;
}

.btn-outline {
    background: var(--color-surface-hover);
    color: var(--color-wood-dark);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    background: #ffffff;
    border-color: var(--color-wood-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Status Indicator Dot */
.status-badge-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(180, 150, 120, 0.15);
}

.status-indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-gold);
    box-shadow: 0 0 8px var(--color-gold);
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.status-indicator-dot.active {
    background-color: var(--color-success);
    box-shadow: 0 0 10px #3c7a4b;
    animation: pulseDot 1.6s infinite;
}

.status-indicator-dot.error {
    background-color: var(--color-danger);
    box-shadow: 0 0 10px #b33939;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.status-text {
    font-size: 0.84rem;
    color: var(--color-wood-medium);
    font-weight: 500;
}

/* Top Result Highlight Card */
.top-result-card {
    background: linear-gradient(135deg, rgba(234, 241, 235, 0.9), rgba(248, 244, 238, 0.95));
    border: 1.5px solid rgba(79, 107, 85, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.top-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-sage);
    margin-bottom: 8px;
}

.top-result-content {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.top-result-content h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-wood-dark);
}

.top-confidence-wrap {
    text-align: right;
}

.confidence-number {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--color-sage);
}

.confidence-label {
    display: block;
    font-size: 0.72rem;
    color: var(--color-wood-medium);
}

.top-progress-bg {
    width: 100%;
    height: 8px;
    background: rgba(79, 107, 85, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.top-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-sage), var(--color-gold));
    border-radius: var(--radius-full);
    transition: width 0.25s ease-out;
}

/* Predictions List Container */
.predictions-wrapper {
    margin-bottom: 22px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-wood-medium);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.predictions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Prediction Row Item */
.prediction-row {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: var(--transition-smooth);
}

.prediction-row:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--color-border-focus);
}

.prediction-row.is-winner {
    border-color: rgba(79, 107, 85, 0.45);
    background: rgba(240, 246, 241, 0.85);
}

.prediction-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.prediction-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-wood-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.prediction-name .class-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-wood-light);
}

.prediction-percentage {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-wood-medium);
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(180, 150, 120, 0.16);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-value {
    height: 100%;
    background: linear-gradient(90deg, var(--color-wood-light), var(--color-terracotta));
    border-radius: var(--radius-full);
    transition: width 0.2s ease-out;
}

.prediction-row.is-winner .progress-bar-value {
    background: linear-gradient(90deg, var(--color-sage), var(--color-gold));
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--color-wood-light);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.35);
}

.empty-state i {
    font-size: 1.8rem;
    margin-bottom: 8px;
    opacity: 0.7;
}

.empty-state p {
    font-size: 0.86rem;
}

/* Advice & Tips Box */
.advice-card {
    background: linear-gradient(135deg, #fdf8f0, #f6eee2);
    border: 1px solid rgba(201, 147, 59, 0.35);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.advice-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(201, 147, 59, 0.18);
    color: var(--color-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.advice-content h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-wood-dark);
    margin-bottom: 4px;
}

.advice-content p {
    font-size: 0.84rem;
    color: var(--color-wood-medium);
    line-height: 1.45;
}

/* Footer */
.app-footer {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.app-footer p {
    font-size: 0.85rem;
    color: var(--color-wood-light);
}

.heart-icon {
    color: var(--color-terracotta);
    animation: heartBeat 1.5s infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--color-wood-dark);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease-out;
}

.toast.toast-error {
    background: var(--color-danger);
}

.toast.toast-success {
    background: var(--color-success);
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Responsivitas (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .app-container {
        padding: 20px 14px 36px;
        gap: 24px;
    }

    .glass-card {
        padding: 20px;
    }

    .viewport-wrapper {
        aspect-ratio: 1 / 1;
        max-height: 340px;
    }
}

@media (max-width: 480px) {
    .control-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
    
    .top-result-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .top-confidence-wrap {
        text-align: left;
    }
}
