/* ===== Camera App ===== */
.app-camera {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface, #1a1a2e);
    color: var(--text, #e0e0e0);
    position: relative;
    overflow: hidden;
}

/* ─── Toolbar ─── */
.camera-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
    flex-shrink: 0;
}

.camera-toolbar-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text, #e0e0e0);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.camera-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.camera-toolbar-btn.active {
    background: var(--accent, #6c5ce7);
    color: #fff;
}

.camera-quality-select {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text, #e0e0e0);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.camera-quality-select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* ─── Viewfinder ─── */
.camera-viewfinder {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    min-height: 200px;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.camera-video.active {
    display: block;
}

.camera-video.mirror {
    transform: scaleX(-1);
}

.camera-canvas {
    display: none;
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.camera-placeholder span {
    font-size: 64px;
}

.camera-placeholder p {
    font-size: 14px;
    margin: 0;
}

/* ─── Overlay Focus ─── */
.camera-overlay-focus {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    display: none;
}

.camera-overlay-focus.show {
    display: block;
}

.camera-overlay-focus::before,
.camera-overlay-focus::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: rgba(255, 255, 255, 0.6);
    border-style: solid;
}

.camera-overlay-focus::before {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-width: 2px 0 0 2px;
    animation: camera-focus-pulse 0.6s ease-out;
}

.camera-overlay-focus::after {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(180deg);
    border-width: 2px 2px 0 0;
    animation: camera-focus-pulse 0.6s ease-out 0.1s;
}

@keyframes camera-focus-pulse {
    0% {
        opacity: 1;
        width: 60px;
        height: 60px;
    }
    100% {
        opacity: 0;
        width: 120px;
        height: 120px;
    }
}

/* ─── Status ─── */
.camera-status {
    text-align: center;
    padding: 4px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

/* ─── Controls ─── */
.camera-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.camera-control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text, #e0e0e0);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.camera-control-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.camera-control-btn span {
    font-size: 20px;
}

.camera-capture-btn {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-capture-btn span {
    font-size: 36px;
    color: #fff;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

.camera-capture-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

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

.camera-capture-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.camera-start-btn {
    background: var(--accent, #6c5ce7);
    color: #fff;
}

.camera-start-btn:hover {
    background: var(--accent-hover, #5a4bd1);
}

.camera-stop-btn {
    background: #e74c3c;
    color: #fff;
}

.camera-stop-btn:hover {
    background: #c0392b;
}

.hidden {
    display: none !important;
}

/* ─── Gallery ─── */
.camera-gallery {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.camera-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.camera-gallery-close {
    background: none;
    border: none;
    color: var(--text, #e0e0e0);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.camera-gallery-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.camera-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.camera-gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.camera-gallery-item:hover {
    border-color: var(--accent, #6c5ce7);
}

.camera-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.4);
    padding: 40px;
    gap: 8px;
}

.camera-gallery-empty span {
    font-size: 48px;
}

/* ─── Toast ─── */
.camera-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    color: #fff;
    opacity: 0;
    transition: all 0.3s;
    z-index: 30;
    pointer-events: none;
}

.camera-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}