/* 
 * Secure Camera - Professional Mobile UX Design
 * Color Philosophy: Trust, Security, Professionalism
 * Dark theme with clean blue accents
 */

:root {
    /* Professional Color Palette */
    --color-bg-primary: #0A0E14;
    --color-bg-secondary: #151B23;
    --color-bg-elevated: #1E2530;
    --color-surface: #2A3441;
    
    /* Trust Colors */
    --color-accent-primary: #0066FF;
    --color-accent-secondary: #0052CC;
    --color-accent-tertiary: #0043A8;
    
    /* Semantic Colors */
    --color-success: #00B887;
    --color-warning: #FF9500;
    --color-error: #FF3B30;
    
    /* Text Colors */
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #A0A8B5;
    --color-text-tertiary: #6B7280;
    
    /* Interactive States */
    --color-interactive-hover: rgba(0, 102, 255, 0.08);
    --color-interactive-pressed: rgba(0, 102, 255, 0.12);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
    
    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Typography */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

/* Start Screen - Professional & Clean */
.start-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-2xl) var(--space-lg);
    background: var(--color-bg-primary);
}

.app-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-lg);
}

h1 {
    font-size: 28px;
    margin-bottom: var(--space-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.5px;
}

p {
    font-size: 15px;
    color: var(--color-text-secondary);
    text-align: center;
    max-width: 320px;
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

.btn-large {
    width: 100%;
    max-width: 320px;
    padding: 16px 24px;
    font-size: 17px;
    font-weight: var(--font-weight-semibold);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--color-accent-primary);
    color: var(--color-text-primary);
}

.btn-primary:hover {
    background: var(--color-accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--color-success);
    color: var(--color-text-primary);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.options {
    margin-top: var(--space-xl);
    width: 100%;
    max-width: 320px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle:active {
    background: var(--color-surface);
}

.toggle input[type="checkbox"] {
    width: 51px;
    height: 31px;
    appearance: none;
    background: var(--color-surface);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle input[type="checkbox"]:checked {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
}

.toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input[type="checkbox"]:checked::before {
    left: 22px;
}

.toggle span {
    font-size: 15px;
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
}

.info-text {
    margin-top: var(--space-lg);
    font-size: 13px;
    color: var(--color-text-tertiary);
    text-align: center;
    max-width: 320px;
    line-height: 1.4;
}

/* Camera Screen - Fullscreen Professional */
#cameraScreen {
    background: #000;
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.camera-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    padding-top: max(var(--space-lg), env(safe-area-inset-top));
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    z-index: 10;
}

.icon-btn {
    background: rgba(30, 37, 48, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:active {
    background: rgba(30, 37, 48, 0.95);
    transform: scale(0.95);
}

.camera-info {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.resolution-badge {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    padding: 4px 8px;
    background: rgba(0, 102, 255, 0.15);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 6px;
    color: var(--color-accent-primary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

#locationIndicator {
    font-size: 18px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Flash Button States */
.flash-btn {
    width: 40px;
    height: 40px;
}

#flashIcon {
    font-size: 18px;
    transition: all 0.2s ease;
}

.flash-btn.flash-on {
    background: rgba(255, 204, 0, 0.2);
    border-color: rgba(255, 204, 0, 0.3);
}

.flash-btn.flash-on #flashIcon {
    color: #FFCC00;
}

.flash-btn.flash-off #flashIcon {
    opacity: 0.6;
}

/* Zoom Buttons - Clean & Professional */
.zoom-buttons {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    background: rgba(30, 37, 48, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 6px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-btn {
    min-width: 48px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-btn.active {
    background: var(--color-accent-primary);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.2);
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* Camera Controls - Professional Layout */
.camera-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: var(--space-xl) var(--space-lg);
    padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    z-index: 10;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:first-child {
    justify-self: start;
}

.control-btn:last-child {
    justify-self: end;
}

.gallery-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.flip-icon {
    font-size: 28px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:active .flip-icon {
    transform: rotate(180deg);
}

/* Capture Button - Professional & Precise */
.capture-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.capture-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all 0.15s ease;
}

.capture-btn:active .capture-ring {
    transform: scale(0.92);
    border-width: 4px;
}

.capture-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    transition: all 0.15s ease;
}

.capture-btn:active .capture-inner {
    transform: scale(0.85);
}

/* Preview Screen - Clean Layout */
.preview-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    padding-top: max(var(--space-lg), env(safe-area-inset-top));
    background: linear-gradient(180deg, var(--color-bg-primary) 0%, transparent 100%);
    z-index: 10;
}

.preview-header h2 {
    font-size: 17px;
    font-weight: var(--font-weight-semibold);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-xl) var(--space-lg);
    padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
    background: linear-gradient(0deg, var(--color-bg-primary) 0%, transparent 100%);
    z-index: 10;
}

.info-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.info-item .icon {
    font-size: 20px;
}

/* Result Screen - Professional Success State */
.result-container {
    padding: var(--space-2xl) var(--space-lg);
    padding-top: max(var(--space-2xl), env(safe-area-inset-top));
    padding-bottom: max(var(--space-2xl), env(safe-area-inset-bottom));
    min-height: 100vh;
    background: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: var(--space-lg);
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-container h2 {
    font-size: 24px;
    margin-bottom: var(--space-xl);
    font-weight: var(--font-weight-semibold);
}

.result-image {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-info {
    width: 100%;
    max-width: 400px;
    background: var(--color-bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.info-row {
    margin-bottom: var(--space-md);
    font-size: 14px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row strong {
    display: block;
    margin-bottom: var(--space-xs);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-row code {
    background: var(--color-surface);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 12px;
    display: block;
    word-break: break-all;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.info-row span {
    color: var(--color-text-primary);
}

.action-buttons {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Attestation Dialog */
.attestation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 20, 0.97);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-lg);
}

.attestation-dialog {
    background: var(--color-bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-xl);
    box-shadow: var(--shadow-xl);
}

.attestation-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: var(--space-md);
}

.attestation-dialog h2 {
    font-size: 22px;
    font-weight: var(--font-weight-semibold);
    text-align: center;
    margin-bottom: var(--space-lg);
}

.attestation-content {
    margin-bottom: var(--space-xl);
}

.attestation-content p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
}

.attestation-content ul {
    list-style: none;
    padding: 0;
    margin: var(--space-md) 0;
}

.attestation-content li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
    padding-left: var(--space-lg);
    position: relative;
}

.attestation-content li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-accent-primary);
    font-weight: var(--font-weight-bold);
}

.attestation-actions {
    display: flex;
    gap: var(--space-md);
    flex-direction: column;
}

/* Loading Overlay - Professional */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 20, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    margin-top: var(--space-lg);
    font-size: 15px;
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

/* Desktop View - Professional Container */
@media (min-width: 768px) {
    .screen {
        max-width: 430px;
        left: 50%;
        transform: translateX(-50%);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    body {
        background: #000;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
