/* === CSS Variables === */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-hover: #252535;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --accent-glow: rgba(249, 115, 22, 0.4);
    --accent-glass: rgba(249, 115, 22, 0.15);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #27272a;
    --border-light: #3f3f46;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s ease;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Header === */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.8;
}

.logo i {
    color: var(--accent);
    font-size: 1.8rem;
}

.admin-link {
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 10px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.admin-link:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

/* === Header Right === */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* === Language Selector === */
.language-selector {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius);
}

.lang-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.lang-btn.active {
    color: white;
    background: var(--accent);
}

/* === Notice === */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.5);
    border-radius: var(--radius);
    margin-bottom: 0;
    margin-top: 4px;
    color: #f87171;
    font-size: 0.8rem;
}

.notice i {
    font-size: 1.4rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.notice-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notice-warning {
    font-weight: 600;
    color: #ef4444;
    font-size: 0.85rem;
}

/* Blinking animation */
.notice-blink {
    animation: noticeBlink 1.5s ease-in-out infinite;
}

@keyframes noticeBlink {
    0%, 100% {
        background: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.5);
    }
    50% {
        background: rgba(239, 68, 68, 0.3);
        border-color: rgba(239, 68, 68, 0.8);
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
    }
}

/* === Access Section === */
.access-section .card {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.access-section h2 i {
    color: var(--accent);
}

.access-section input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    font-weight: 600;
}

/* Password Toggle */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--accent);
}

.password-toggle.active {
    color: var(--accent);
}

/* === AGB Checkbox === */
.agb-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin-top: 8px;
}

.agb-checkbox input[type="checkbox"] {
    display: none;
}

.agb-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    position: relative;
    flex-shrink: 0;
    transition: var(--transition);
}

.agb-checkbox:hover .checkmark {
    border-color: var(--accent);
}

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

.agb-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.agb-checkbox .agb-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.agb-checkbox .agb-text a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.agb-checkbox .agb-text a:hover {
    text-decoration: underline;
}

/* === Form Fields === */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2, .card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-weight: 600;
}

.card h2 i, .card h3 i {
    color: var(--accent);
}

.card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* === Input Group === */
.input-group {
    display: flex;
    gap: 12px;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
        0 4px 15px var(--accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px var(--accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-full {
    width: 100%;
}

/* === Upload Progress === */
.upload-progress {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.progress-bar {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.2s ease;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px var(--accent-glow); }
    50% { box-shadow: 0 0 15px var(--accent-glow); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

#progressText {
    font-weight: 600;
    color: var(--accent);
}

#progressSize {
    color: var(--text-muted);
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tab i {
    font-size: 1rem;
}

/* === Tab Content === */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Dropzone === */
.dropzone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: rgba(249, 115, 22, 0.05);
}

.dropzone i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 16px;
}

.dropzone p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dropzone span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === Upload Buttons === */
.upload-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.upload-buttons .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-encrypted {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    opacity: 0.8;
    margin-left: 8px;
}

.upload-encrypted i {
    font-size: 0.75rem;
    color: var(--success);
}

/* === File List === */
.file-list {
    margin-bottom: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.file-item i {
    color: var(--accent);
    font-size: 1.2rem;
}

.file-item .file-info {
    flex: 1;
}

.file-item .file-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.file-item .file-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-item .remove-file {
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

.file-item .remove-file:hover {
    color: var(--danger);
}

/* === Camera Preview === */
.camera-preview {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    min-height: 280px;
    transition: var(--transition);
}

.camera-preview.active {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.stream-preview-container {
    position: relative;
    margin-bottom: 20px;
    overflow: hidden;
}

.stream-preview {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    min-height: 280px;
    transition: var(--transition);
    isolation: isolate; /* Create new stacking context */
}

.stream-preview.active {
    border-color: var(--danger);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
    animation: liveGlow 2s ease-in-out infinite;
}

@keyframes liveGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 35px rgba(239, 68, 68, 0.6); }
}

.camera-preview video,
.stream-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Stream start button overlay */
.stream-start-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    padding: 16px 32px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stream-start-overlay:hover {
    transform: translate(-50%, -50%) scale(1.05) !important;
}

.stream-start-overlay.hidden {
    display: none;
}

/* Camera placeholder when inactive */
.camera-preview::before,
.stream-preview::before {
    content: '\f03d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.3;
    position: absolute;
}

.camera-preview:has(video[srcObject]),
.stream-preview:has(video[srcObject]) {
    border-color: var(--success);
}

.camera-preview::before,
.stream-preview::before {
    display: none;
}

.camera-preview:not(.active)::before,
.stream-preview:not(.active)::before {
    display: block;
}

.admin-draw-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    display: none;
}

.stream-preview video {
    position: relative;
    z-index: 1;
}

.fullscreen-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.fullscreen-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Fullscreen mode for user stream */
.stream-preview-container.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #000;
    margin: 0;
    border-radius: 0;
}

.stream-preview-container.fullscreen-mode .stream-preview {
    width: 100%;
    height: 100%;
    border-radius: 0;
    aspect-ratio: unset;
}

.stream-preview-container.fullscreen-mode .fullscreen-toggle {
    top: 20px;
    right: 20px;
}

.camera-controls,
.stream-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.camera-controls .btn {
    flex: 1;
    min-width: 100px;
}

/* === Recording Indicator === */
.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    margin-top: 16px;
    color: var(--danger);
}

.recording-dot {
    animation: pulse 1s infinite;
}

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

.audio-indicator {
    margin-left: auto;
    color: var(--success);
    animation: audioPulse 0.5s ease-in-out infinite alternate;
}

.audio-indicator.no-audio {
    color: var(--text-muted);
    animation: none;
    opacity: 0.5;
}

@keyframes audioPulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.2); opacity: 1; }
}

/* === Stream Status === */
.stream-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    margin-top: 16px;
    color: var(--success);
}

.live-dot {
    color: var(--danger);
    animation: pulse 1s infinite;
}

.stream-active-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.stream-active-controls .btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    padding: 12px 14px;
    font-size: 0.9rem;
}

.stream-active-controls .btn-danger {
    flex: 1 1 100%;
    order: 3;
}

.stream-audio-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stream-audio-status.muted {
    color: var(--danger);
}

.stream-audio-status.muted i {
    position: relative;
}

.stream-audio-status.muted i::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--danger);
    transform: rotate(45deg);
    transform-origin: center;
}

.stream-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.stream-info i {
    color: var(--accent);
    margin-top: 2px;
}

/* === Customer Info === */
.customer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 30px;
    color: var(--text-secondary);
}

.customer-info i {
    color: var(--success);
}

.case-badge {
    margin-left: auto;
    padding: 4px 10px;
    background: var(--accent);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* === Notifications === */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.notification.success {
    border-color: var(--success);
}

.notification.success i {
    color: var(--success);
}

.notification.error {
    border-color: var(--danger);
}

.notification.error i {
    color: var(--danger);
}

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

/* === Utility === */
.hidden {
    display: none !important;
}

/* === Responsive === */
@media (max-width: 600px) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .container {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .header {
        padding: 15px 0;
        margin-bottom: 20px;
    }

    .logo {
        font-size: 1.3rem;
    }

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

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .card h2, .card h3 {
        font-size: 1.1rem;
    }

    .tabs {
        gap: 6px;
        margin-bottom: 16px;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 12px 16px;
        font-size: 0.9rem;
        flex: 1;
        justify-content: center;
    }

    .tab span {
        display: none;
    }

    .tab i {
        font-size: 1.2rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn {
        padding: 16px 20px;
        font-size: 1rem;
        min-height: 52px;
        -webkit-tap-highlight-color: transparent;
    }

    .dropzone {
        padding: 30px 20px;
    }

    .dropzone i {
        font-size: 2.5rem;
    }

    .dropzone p {
        font-size: 1rem;
    }

    .camera-preview,
    .stream-preview {
        aspect-ratio: 4/3;
        border-radius: 12px;
    }

    .camera-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .camera-controls .btn {
        min-width: unset;
        padding: 12px 14px;
        flex: 1 1 auto;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .camera-controls #startCameraBtn {
        flex: 1 1 100%;
    }

    .camera-controls #switchCameraBtn {
        flex: 0 1 auto;
    }

    .camera-controls #capturePhotoBtn,
    .camera-controls #startRecordingBtn {
        flex: 1 1 calc(50% - 4px);
    }

    .stream-active-controls .btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .stream-active-controls #switchStreamCameraBtn,
    .stream-active-controls #toggleStreamAudioBtn {
        flex: 1 1 calc(50% - 4px);
    }

    .notifications {
        top: auto;
        bottom: 20px;
        left: 12px;
        right: 12px;
    }

    .notification {
        min-width: unset;
        width: 100%;
    }

    .file-item {
        padding: 14px 12px;
    }

    .file-item .file-name {
        font-size: 0.9rem;
        word-break: break-word;
    }

    .customer-info {
        margin-top: 20px;
        padding: 14px;
        font-size: 0.9rem;
    }

    textarea {
        min-height: 150px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    input[type="text"],
    input[type="password"] {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 16px;
    }
}

/* === Touch Optimizations === */
@media (hover: none) and (pointer: coarse) {
    .btn:active {
        transform: scale(0.98);
    }

    .tab:active {
        transform: scale(0.95);
    }

    .dropzone:active {
        transform: scale(0.99);
    }

    .file-item .remove-file {
        padding: 10px;
    }
}

/* === Very Small Screens === */
@media (max-width: 380px) {
    .container {
        padding: 10px;
    }

    .logo span {
        font-size: 1.1rem;
    }

    .tab {
        padding: 10px 12px;
    }

    .camera-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .camera-controls .btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .camera-controls #startCameraBtn {
        flex: 1 1 100%;
    }

    .camera-controls #switchCameraBtn {
        flex: 1 1 100%;
        order: 3;
    }

    .camera-controls #capturePhotoBtn,
    .camera-controls #startRecordingBtn {
        flex: 1 1 calc(50% - 3px);
    }

    .btn {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    .card {
        padding: 16px;
    }
}

/* === Admin Message Modal === */
.admin-message-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.admin-message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
}

.admin-message-content {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 30px var(--accent-glow);
    animation: slideUp 0.3s ease;
}

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

.admin-message-modal.closing {
    animation: fadeOut 0.3s ease forwards;
}

.admin-message-modal.closing .admin-message-content {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(30px); }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

.admin-message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 600;
}

.admin-message-header i {
    font-size: 1.3rem;
}

.admin-message-time {
    margin-left: auto;
    font-size: 0.85rem;
    opacity: 0.8;
}

.admin-message-body {
    padding: 20px;
}

.admin-message-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.admin-message-actions {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.admin-message-actions .btn {
    flex: 1;
}

.admin-message-actions .copy-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
}

/* === Admin File Modal === */
.admin-file-content {
    max-width: 500px;
}

.admin-file-media {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--bg-primary);
    margin-bottom: 12px;
}

.admin-file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.admin-file-icon i {
    font-size: 3rem;
    color: var(--accent);
}

.admin-file-icon span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-all;
    text-align: center;
}

.admin-file-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* === QR Code Section === */
.qr-code-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qr-label i {
    color: var(--accent);
}

#qrcode {
    padding: 10px;
    background: #1a1a2e;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#qrcode:hover {
    transform: scale(1.8);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    position: relative;
}

#qrcode img {
    display: block;
    border-radius: 4px;
}

.qr-url-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.qr-url-copy:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.qr-url-copy.copied {
    border-color: var(--success);
}

.qr-url-copy.copied i {
    color: var(--success);
}

.qr-url-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', monospace;
}

.qr-url-copy i {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: var(--transition);
}

/* === Permission Help Modal === */
.permission-help-modal {
    max-width: 450px;
}

.permission-help-modal .modal-header {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.permission-help-modal .modal-header h3 {
    color: white;
}

.permission-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.permission-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.permission-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-content strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.step-content span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.permission-alternative {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
}

.permission-alternative p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

.permission-alternative i {
    color: #22c55e;
}

/* === Footer === */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

/* === Version Badge === */
.version-badge {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    opacity: 0.6;
    transition: var(--transition);
    font-family: 'Monaco', 'Menlo', monospace;
}

.version-badge:hover {
    opacity: 1;
    color: var(--accent);
    border-color: var(--accent);
}

/* === Tablet & Desktop === */
@media (min-width: 768px) {
    .container {
        padding: 30px 40px;
    }

    .header {
        padding: 25px 0;
        margin-bottom: 40px;
    }

    .logo {
        font-size: 1.8rem;
    }

    .logo i {
        font-size: 2.2rem;
    }

    .card {
        padding: 30px;
        border-radius: var(--radius-lg);
    }

    .card h2, .card h3 {
        font-size: 1.3rem;
    }

    .tabs {
        gap: 12px;
        margin-bottom: 25px;
    }

    .tab {
        padding: 14px 28px;
        font-size: 1rem;
    }

    .dropzone {
        padding: 50px;
    }

    .dropzone i {
        font-size: 4rem;
    }

    .dropzone p {
        font-size: 1.2rem;
    }

    .camera-preview,
    .stream-preview {
        aspect-ratio: 16/9;
    }

    .camera-controls {
        display: flex;
        gap: 12px;
    }

    .camera-controls .btn {
        flex: 1;
    }

    .btn {
        padding: 16px 28px;
    }

    .customer-info {
        padding: 20px;
    }

    .notice {
        padding: 16px 24px;
        font-size: 1rem;
    }
}

/* === Large Desktop === */
@media (min-width: 1200px) {
    .container {
        max-width: 1000px;
        padding: 40px 50px;
    }

    .header {
        padding: 30px 0;
        margin-bottom: 50px;
    }

    .logo {
        font-size: 2rem;
    }

    .card {
        padding: 35px;
    }

    .tabs {
        gap: 16px;
    }

    .tab {
        padding: 16px 32px;
    }

    .dropzone {
        padding: 60px;
    }

    .footer {
        margin-top: 60px;
        padding: 30px;
    }
}

/* === Image Editor Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.image-editor-modal {
    width: 95vw;
    height: 95vh;
    max-width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.modal-header h3 i {
    color: var(--accent);
}

.close-modal {
    background: var(--bg-hover);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #000;
}

.editor-container {
    width: 100%;
    height: 100%;
}

.editor-canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#editorCanvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius);
    cursor: crosshair;
    touch-action: none;
}

.editor-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.tool-group {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1rem;
}

.tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent);
    color: white;
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.size-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.size-btn:hover {
    background: var(--bg-hover);
}

.size-btn.active {
    background: var(--accent);
}

.size-dot {
    background: var(--text-primary);
    border-radius: 50%;
    display: block;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Edit button for file items */
.file-item {
    position: relative;
}

.edit-image-btn {
    position: absolute;
    top: 8px;
    right: 40px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: var(--transition);
    opacity: 0;
}

.file-item:hover .edit-image-btn {
    opacity: 1;
}

.edit-image-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* Text input for image editor */
.editor-text-input {
    position: fixed;
    padding: 8px 12px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 16px;
    min-width: 100px;
    z-index: 10000;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
