/* Smena - Coffee Quality Detector Styles */

:root {
    --primary-color: #6F4E37;
    --primary-light: #8B6914;
    --primary-dark: #4A3728;
    --accent-color: #D4A574;
    --background-dark: #1a1a1a;
    --background-light: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #f44336;
    --gradient-coffee: linear-gradient(135deg, #6F4E37 0%, #D4A574 100%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styles */
.header {
    padding: 1rem 1.5rem;
    background: var(--background-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-coffee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Screen States */
.screen {
    display: none;
    width: 100%;
    max-width: 600px;
}

.screen.active {
    display: block;
}

/* Permission Screen */
.permission-card,
.error-card {
    background: var(--background-light);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.permission-icon,
.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.permission-card h2,
.error-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.permission-card p,
.error-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-coffee);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(111, 78, 55, 0.4);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Camera Container */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#detection-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Detection Overlay */
.detection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border: 2px solid var(--accent-color);
    border-radius: 16px;
}

.scanning-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; opacity: 1; }
    50% { opacity: 0.5; }
    100% { top: 100%; opacity: 1; }
}

/* Quality Widget */
.quality-widget {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 200px;
    background: rgba(26, 26, 26, 0.95);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.quality-widget.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--gradient-coffee);
}

.widget-icon {
    font-size: 1.2rem;
}

.widget-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.widget-body {
    padding: 1rem;
}

.quality-score {
    text-align: center;
    margin-bottom: 1rem;
}

.quality-score .grade {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-coffee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quality-score .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Quality Metrics */
.quality-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    background: var(--gradient-coffee);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.detection-status {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    text-align: center;
}

.detection-status.detected {
    color: var(--success-color);
}

/* Controls */
.controls {
    margin-top: 1rem;
    text-align: center;
}

/* Footer */
.footer {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 480px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .permission-card,
    .error-card {
        padding: 1.5rem;
    }

    .quality-widget {
        width: 160px;
        bottom: 0.5rem;
        right: 0.5rem;
    }

    .quality-score .grade {
        font-size: 2rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Pulse Animation for Detection */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(111, 78, 55, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(111, 78, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(111, 78, 55, 0); }
}

.quality-widget.pulse {
    animation: pulse 1.5s infinite;
}
