/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

/* Main app container - mobile first */
.app-container {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* App header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Square photobooth frame (1:1 aspect ratio) */
.photobooth-frame {
    position: relative;
    width: 90%;
    aspect-ratio: 1;
    background: url('Booth Photo.png') no-repeat center center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    margin: 22px auto;
}

/* Camera viewport (80% of frame area, centered to match custom frame) */
.camera-viewport {
          width: 63%;
    height: 63%;
    position: relative;
    border-radius: 0%;
    overflow: hidden;
     background: transparent; 
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 100%;
    /*padding: 24px;*/
}
/*.curved-text {*/
/*          position: absolute;*/
/*    width: 92%;*/
/*    height: 65%;*/
/*    top: 88px;*/
/*    left: 15px;*/
/*    pointer-events: none;*/
/*    border-radius: 100%;*/
/*    background-color: red;*/
/*}*/

/*.curved-text svg {*/
/*    width: 100%;*/
/*    height: 100%;*/
/*    transform: rotate(-90deg);   */
/*}*/

/* Video element */
.curved-text {
    width: 100%;
    height: 100%;
    padding: 6px;
    background-color: red;
    position: absolute;
}

.curved-text svg {
    width: 100%;
    height: 100%;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
    /*border-radius:50%;*/
      border: none;
}

/* Error message styles */
.error-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    z-index: 10;
}

.error-message i {
    font-size: 2rem;
    color: #dc3545;
    margin-bottom: 15px;
}

.error-message h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #495057;
}

.error-message p {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.4;
}

.retry-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.retry-btn:hover {
    background: #0056b3;
}

/* Loading state */
.loading-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-state p {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Camera controls */
.camera-controls {
      position: absolute;
    bottom: 13px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 20;
}

.capture-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    border: 4px solid #007bff;
    color: #007bff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.capture-button:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
}

.capture-button:active {
    transform: scale(0.95);
}

.switch-camera-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #495057;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.switch-camera-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* Photo preview styles */
.photo-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.preview-header h3 {
    color: white;
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.preview-image-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        padding: 16px;
    background-color: #fff;
}

.preview-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.action-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.download-btn {
    background: #28a745;
    color: white;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.retake-btn {
    background: #6c757d;
    color: white;
}

.retake-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* App footer */
.app-footer {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
}

.instructions {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
}

/* Desktop responsive design - constrain to mobile viewport */
@media (min-width: 768px) {
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .app-container {
        width: 400px;
        max-width: 400px;
    }
    
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 767px) and (orientation: landscape) {
    body {
        padding: 10px;
    }
    
    .app-container {
        max-width: 350px;
    }
    
    .app-header {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .photobooth-frame {
        border-width: 6px;
    }
}

/* Touch improvements for mobile */
@media (max-width: 767px) {
    .capture-button {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }
    
    .switch-camera-btn {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }
    
    .action-btn {
        padding: 13px 10px;
        font-size: 1.1rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }
    
    .capture-button,
    .switch-camera-btn,
    .action-btn {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .photobooth-frame {
        border-color: #000;
    }
    
    .error-message {
        background: white;
        border: 2px solid #000;
    }
}