/* Custom styles for Self Photo Studio */

* {
    font-family: 'Noto Sans KR', sans-serif;
}

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.2s ease-in-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Upload zone hover effects */
#upload-zone:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(147, 51, 234, 0.15);
}

/* Sample background hover effects */
.sample-bg:hover {
    transform: scale(1.05);
}

/* Camera stream styling */
#camera-stream {
    border-radius: 12px;
}

/* Canvas container */
#composition-canvas {
    cursor: move;
    border-radius: 12px;
}

/* Custom range slider styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: #e5e7eb;
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #7c3aed;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    background: #e5e7eb;
    height: 6px;
    border-radius: 3px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    background: #7c3aed;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Button hover effects */
button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Step indicators animation */
.step-indicator-active {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    color: white !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    #composition-canvas {
        touch-action: manipulation;
        cursor: grab;
    }
    
    #composition-canvas:active {
        cursor: grabbing;
    }
    
    /* Make buttons more touch-friendly on mobile */
    button {
        min-height: 48px;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    /* Adjust text sizes for mobile */
    h1 {
        font-size: 1.25rem;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    /* Compact step indicators on mobile */
    .step-indicator {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    /* Mobile control panel - stack vertically */
    .lg\:grid-cols-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lg\:col-span-3,
    .lg\:col-span-1 {
        grid-column: 1;
    }
    
    /* Compact control panel on mobile */
    .bg-gray-50.rounded-xl.p-6 {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    /* Touch-friendly sliders */
    input[type="range"] {
        height: 32px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        height: 28px;
        width: 28px;
    }
    
    input[type="range"]::-moz-range-thumb {
        height: 28px;
        width: 28px;
    }
    
    /* Mobile toast - smaller and bottom positioned */
    .toast {
        position: fixed;
        bottom: 20px;
        left: 10px;
        right: 10px;
        top: auto;
        padding: 12px 16px;
        font-size: 0.875rem;
        border-radius: 8px;
        transform: translateY(100px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    /* Mobile loading overlay - smaller */
    #loading-overlay .bg-white {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    /* Mobile result grid - single column */
    .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Mobile button grid - smaller gaps */
    .grid.grid-cols-2.gap-3 {
        gap: 0.5rem;
    }
    
    /* Compact mobile buttons */
    .bg-blue-600.py-2,
    .bg-purple-600.py-2 {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    /* Minimal padding for very small screens */
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Compact header */
    header .container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    header h1 {
        font-size: 1rem;
    }
    
    /* Very compact titles */
    h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    /* Extra compact buttons */
    button {
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
        min-height: 44px;
    }
    
    /* Very compact control panel */
    .bg-gray-50.rounded-xl.p-6 {
        padding: 0.75rem;
    }
    
    /* Smaller control labels */
    .bg-gray-50 label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    /* Compact button grids */
    .grid.grid-cols-2.gap-2 {
        gap: 0.25rem;
    }
    
    .grid.grid-cols-2.gap-2 button {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Ultra compact toast */
    .toast {
        padding: 8px 12px;
        font-size: 0.8rem;
        bottom: 10px;
        left: 5px;
        right: 5px;
    }
    
    /* Smaller step indicators */
    .w-8.h-8 {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.7rem;
    }
    
    /* Compact service description */
    .text-center.mb-12 p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    /* Optimize for landscape mobile viewing */
    .min-h-screen {
        min-height: 100vh;
    }
    
    /* Compact header in landscape */
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }
    
    main {
        padding-top: 80px;
    }
    
    /* Side-by-side layout in landscape */
    .lg\:grid-cols-4 {
        grid-template-columns: 2fr 1fr;
        gap: 1rem;
    }
}

/* Print styles - hide UI elements when printing */
@media print {
    header, footer, .control-panel, button {
        display: none;
    }
    
    #result-preview {
        width: 100%;
        max-width: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-gradient-to-br {
        background: #ffffff;
    }
    
    .text-purple-600 {
        color: #000000;
    }
    
    .border-purple-300 {
        border-color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Mobile touch optimization */
@media (max-width: 768px) {
    /* Prevent text selection during touch */
    * {
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* Allow selection for input elements */
    input, textarea, [contenteditable] {
        -webkit-user-select: text;
        -moz-user-select: text;
        user-select: text;
    }
    
    /* Improve touch targets */
    button, .sample-bg, input[type="range"] {
        touch-action: manipulation;
    }
    
    /* Prevent zoom on double tap */
    .no-zoom {
        touch-action: pan-x pan-y;
    }
    
    /* Better scroll behavior */
    body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Optimize canvas for mobile */
    #composition-canvas {
        touch-action: none;
        -webkit-user-drag: none;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

/* Camera preview positioning helper */
.camera-preview-container {
    position: relative;
    overflow: hidden;
}

.camera-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border: 2px dashed rgba(124, 58, 237, 0.5);
    border-radius: 12px;
}

/* Draggable element styling */
.draggable {
    cursor: move;
    user-select: none;
}

.dragging {
    opacity: 0.8;
    transform: scale(1.05);
    z-index: 1000;
}

/* Success and error states */
.success-state {
    border-color: #10b981;
    background-color: #ecfdf5;
}

.error-state {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* Toast notification styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease-in-out;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

/* Canvas interaction hints */
.canvas-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.canvas-hint.show {
    opacity: 1;
}