/**
 * Photo Shoot Styles
 * 撮影画面専用スタイル (shoot_edit.php - カメラ/ウェルカム/確認/ノーマルモード)
 */
@import url('tokens.css');

/* Welcome Navbar */
.welcome-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 16px;
    z-index: 250;
    box-shadow: 0 1px 4px rgba(120, 100, 80, 0.08);
    transition: opacity 0.3s, transform 0.3s;
}

.welcome-navbar.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
}

.welcome-navbar .navbar-hint {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.navbar-hint .hint-fav { color: var(--heart); }
.navbar-hint .hint-later { color: var(--primary); }
.welcome-navbar .navbar-arrow { font-size: 10px; color: var(--text-muted); }

.welcome-navbar .navbar-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.welcome-navbar .navbar-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-overlay);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 60px 40px;
    box-shadow: 0 25px 60px rgba(120, 100, 80, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.5s;
    max-width: 90%;
    width: 500px;
}

.welcome-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-content {
    text-align: center;
    color: var(--text-primary);
    padding: 0;
}

.welcome-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.start-btn {
    padding: 18px 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px var(--primary-shadow);
    transition: all 0.3s;
}

.start-btn:active {
    transform: scale(0.95);
}

.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.start-btn.gallery-btn {
    background: var(--success);
    box-shadow: 0 10px 30px rgba(67, 233, 123, 0.3);
}

/* Favorite Button */
.favorite-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--gray-300);
    transition: transform 0.2s, color 0.2s;
    z-index: 210;
}
.favorite-btn:active { transform: scale(0.9); }
.favorite-btn.favorited { color: var(--heart); }
.favorite-btn.favorited .fa-heart { animation: heartbeat 0.4s ease-in-out; }

@keyframes heartbeat {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Camera View */
.camera-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-camera);
    display: none;
}

.camera-container.active {
    display: block;
}

/* ネイティブカメラ時: WebView背景を透明にしてネイティブプレビューを見せる */
.native-camera-active {
    background: transparent !important;
}
html.native-camera-active,
body.native-camera-active {
    background: transparent !important;
}
.native-camera-active #camera-video {
    visibility: hidden;
}

#camera-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 20;
}

.capture-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 5px solid white;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.capture-btn:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.5);
}

.capture-btn::after {
    content: '';
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
}

.switch-camera-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.switch-camera-btn:active {
    transform: scale(0.9);
}

.zoom-toggle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.zoom-toggle-btn:active {
    transform: scale(0.9);
}

.zoom-toggle-btn.active {
    background: rgba(255,255,255,0.4);
}

/* Zoom Control */
.zoom-control {
    position: absolute;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 30px;
    z-index: 25;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.zoom-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-icon {
    font-size: 18px;
    user-select: none;
}

.zoom-slider {
    width: 150px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.zoom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.zoom-value {
    min-width: 45px;
    text-align: right;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .zoom-control {
        bottom: 120px;
    }
    .zoom-slider {
        width: 120px;
    }
}

@supports (padding: env(safe-area-inset-bottom)) {
    .zoom-control {
        bottom: calc(130px + env(safe-area-inset-bottom));
    }
}

/* Photo Confirm Overlay */
.photo-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.confirm-preview-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.confirm-frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.confirm-frame-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.confirm-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 20px);
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    gap: 12px;
    z-index: 31;
}

.confirm-btn {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.confirm-btn.retake {
    background: rgba(250, 248, 245, 0.2);
    color: white;
}

.confirm-btn.retake:active {
    background: rgba(250, 248, 245, 0.3);
}

.confirm-btn.proceed {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 25px rgba(255, 61, 92, 0.3);
}

.confirm-btn.proceed:active {
    transform: scale(0.98);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    position: absolute;
    bottom: 40%;
    color: white;
    font-size: 16px;
}

#processing-canvas {
    display: none;
}

/* Frame Darkening Overlay (Frame Mode Only) */
.frame-darkening-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.frame-darkening-overlay .overlay-top,
.frame-darkening-overlay .overlay-bottom,
.frame-darkening-overlay .overlay-left,
.frame-darkening-overlay .overlay-right {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
}

/* Welcome Background */
.welcome-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.5s;
    z-index: 199;
}

.welcome-background:not([data-ad-background]) {
    filter: blur(8px) brightness(0.7);
    transform: scale(1.1);
}

.welcome-background.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   Normal Mode Styles
   ============================================ */

#frame-container-normal {
    position: absolute;
    cursor: move;
    z-index: 10;
    transform-origin: center;
}

#frame-image-normal {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--text-primary);
    border-radius: 50%;
    z-index: 11;
    cursor: nwse-resize;
}

.resize-handle:active {
    background: var(--secondary);
}

.resize-handle.top-left { top: -15px; left: -15px; cursor: nwse-resize; }
.resize-handle.top-right { top: -15px; right: -15px; cursor: nesw-resize; }
.resize-handle.bottom-left { bottom: -15px; left: -15px; cursor: nesw-resize; }
.resize-handle.bottom-right { bottom: -15px; right: -15px; cursor: nwse-resize; }

/* Capture Area Overlay (Normal Mode) */
.capture-area-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.capture-area-overlay .overlay-top,
.capture-area-overlay .overlay-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.capture-area-overlay .overlay-top {
    top: 0;
    height: 30px;
}

.capture-area-overlay .overlay-bottom {
    bottom: 0;
    height: 130px;
}

/* Control Panel (Normal Mode) */
.control-panel-normal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--editor-surface);
    padding: 15px 20px;
    z-index: 150;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.control-panel-normal .sliders-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-panel-normal .slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.control-panel-normal .slider-container span:first-child {
    min-width: 60px;
    font-size: 13px;
}

.control-panel-normal .slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-700);
    outline: none;
    -webkit-appearance: none;
}

.control-panel-normal .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.control-panel-normal .slider-value {
    min-width: 50px;
    text-align: right;
    font-size: 13px;
    color: white;
}

.control-panel-normal .button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-panel-normal .control-btn {
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.control-panel-normal .control-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

/* Menu Button (Normal Mode) */
.menu-button-normal {
    position: fixed;
    bottom: 40px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.menu-button-normal:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.9);
}

@supports (padding: env(safe-area-inset-bottom)) {
    .control-panel-normal {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
    .menu-button-normal {
        bottom: calc(40px + env(safe-area-inset-bottom));
    }
}

/* Desktop Support */
@media (min-width: 768px) {
    .camera-container {
        left: 50%;
        transform: translateX(-50%);
    }
    #camera-video {
        left: 50%;
        transform: translateX(-50%);
    }
    .frame-overlay-container {
        left: 50%;
        transform: translateX(-50%);
    }
    .welcome-screen {
        max-width: 500px;
    }
    .welcome-background:not([data-ad-background]) {
        transform: translateX(-50%) scale(1.1);
    }
}

/* Advertisement Banner Styles */
.advertisement-banner {
    width: 100%;
    max-width: 320px;
    margin: 0 auto 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(120,100,80,0.15);
    background: var(--bg-card);
    position: relative;
}

.ad-label {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    z-index: 1;
}

.advertisement-banner a {
    display: block;
    text-decoration: none;
}

.ad-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 100px;
    object-fit: contain;
}

.advertisement-banner:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

@media (max-width: 360px) {
    .advertisement-banner {
        max-width: 280px;
    }
    .ad-image {
        max-height: 87px;
    }
}

@media (max-width: 320px) {
    .advertisement-banner {
        max-width: 240px;
    }
    .ad-image {
        max-height: 75px;
    }
}
