/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* Global font styling */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

button {
    font-family: 'Inter', sans-serif !important;
    font-weight: 500;
    cursor: pointer;
}

/* Better text rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    /* Prevent zooming */
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    overflow-x: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
}

#camera,
#camera--view,
#camera--sensor,
#camera--output {
    position: fixed;
    height: 100%;
    width: 100%;
    object-fit: cover;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    overflow-x: hidden;
}

/* Button layout container */
.button-container {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    max-width: 500px;
    margin: 0 auto;
    z-index: 1000;
    /* Add subtle background for better visibility */
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
    backdrop-filter: blur(5px);
    border-radius: 50px;
}

/* Main photo button - centered */
#camera--trigger {
    width: 240px;
    background: linear-gradient(135deg, #000000, #1a1a1a);
    color: white;
    font-size: 18px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 35px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 20px 28px;
    text-align: center;
    box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.4);
    letter-spacing: 0.8px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 100;
    text-transform: uppercase;
}

#camera--trigger:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #1a1a1a, #000000);
    border-color: rgba(255, 255, 255, 0.2);
}

#camera--trigger:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px 0 rgba(0, 0, 0, 0.4);
}

/* Camera toggle button - right side */
#camera--toggle {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #000000, #1a1a1a);
    color: white;
    font-size: 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    text-align: center;
    box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 100;
}

#camera--toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #1a1a1a, #000000);
    border-color: rgba(255, 255, 255, 0.2);
}

#camera--toggle:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px 0 rgba(0, 0, 0, 0.4);
}

#camera--toggle::before {
    content: "";
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 13c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z'/%3E%3Cpath d='M12 8.5c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5zm0 5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z'/%3E%3Cpath d='M17.5 6.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5z'/%3E%3Cpath d='M16 6.5l2-2 2 2'/%3E%3Cpath d='M8 17.5l-2 2-2-2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: brightness(1);
    transition: all 0.3s ease;
}

#camera--toggle:hover::before {
    filter: brightness(1.3);
    transform: rotate(180deg);
}

.taken {
    height: 100px !important;
    width: 100px !important;
    transition: all 0.5s ease-in;
    border: solid 3px white;
    box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.2);
    top: 20px;
    right: 20px;
    z-index: 2;
}

/* SweetAlert responsive styles */
.swal-responsive-popup {
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    background: rgba(0, 0, 0, 0.9) !important;
    border: 1px solid #333 !important;
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
}

.swal-responsive-image {
    max-width: 100% !important;
    max-height: 70vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
}

.swal-title-white {
    color: #ffffff !important;
    font-weight: 500 !important;
    font-family: 'Inter', sans-serif !important;
    letter-spacing: 0.3px !important;
}

/* Standardized button styles */
.swal-confirm-button,
.swal-cancel-button,
.swal-download-button {
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    margin: 0 5px !important;
    min-width: 120px !important;
    cursor: pointer !important;
    font-family: 'Inter', sans-serif !important;
}

/* Confirm button (Upload) - Blue */
.swal-confirm-button {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3) !important;
}

.swal-confirm-button:hover {
    background: linear-gradient(135deg, #0056b3, #004085) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4) !important;
}

/* Cancel button (Close/Back) - Gray */
.swal-cancel-button {
    background: linear-gradient(135deg, #6c757d, #545b62) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3) !important;
}

.swal-cancel-button:hover {
    background: linear-gradient(135deg, #545b62, #383d41) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4) !important;
}

/* Download button - Green */
.swal-download-button {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3) !important;
}

.swal-download-button:hover {
    background: linear-gradient(135deg, #218838, #1ea572) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4) !important;
}

/* Active states for all buttons */
.swal-confirm-button:active,
.swal-cancel-button:active,
.swal-download-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

/* Button container responsive layout */
.swal-actions-inline {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    margin-top: 1rem !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .swal-confirm-button,
    .swal-cancel-button,
    .swal-download-button {
        font-size: 12px !important;
        padding: 10px 16px !important;
        margin: 2px !important;
        min-width: 100px !important;
    }
    
    .swal-actions-inline {
        gap: 6px !important;
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .swal-confirm-button,
    .swal-cancel-button,
    .swal-download-button {
        font-size: 11px !important;
        padding: 8px 14px !important;
        margin: 2px !important;
        min-width: 90px !important;
    }
    
    .swal-actions-inline {
        gap: 4px !important;
        margin-top: 0.5rem !important;
    }
}

/* Landscape orientation layout */
.swal-landscape {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    max-width: 95vw !important;
    max-height: 85vh !important;
    padding: 15px !important;
    box-sizing: border-box !important;
}

.swal-landscape .swal2-header {
    display: none !important;
}

.swal-landscape .swal2-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.swal-landscape .swal2-image {
    max-width: 60vw !important;
    max-height: 75vh !important;
    flex-shrink: 0 !important;
}

.swal-landscape .swal2-actions {
    flex-direction: column !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 140px !important;
    max-width: 170px !important;
    flex-shrink: 0 !important;
}

.swal-landscape .swal2-confirm {
    width: 100% !important;
    max-width: 140px !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
}

.swal-landscape .swal2-cancel {
    width: 100% !important;
    max-width: 140px !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
}

.swal-landscape .swal2-close {
    top: 10px !important;
    right: 10px !important;
    color: #ffffff !important;
    font-size: 24px !important;
}

/* Override SweetAlert default styles for mobile */
@media (max-width: 768px) {
    .swal2-popup {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 0 !important;
        padding: 0.5rem !important;
        background: rgba(0, 0, 0, 0.9) !important;
        font-family: 'Inter', sans-serif !important;
    }

    .swal2-image {
        max-width: 100% !important;
        max-height: 60vh !important;
    }

    .swal2-title {
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem !important;
        color: #ffffff !important;
        font-family: 'Inter', sans-serif !important;
        font-weight: 500 !important;
        letter-spacing: 0.3px !important;
    }

    .swal2-actions {
        margin-top: 0.5rem !important;
    }

    .swal2-confirm {
        font-family: 'Inter', sans-serif !important;
        font-weight: 500 !important;
        letter-spacing: 0.3px !important;
    }

    /* Landscape on mobile */
    .swal-landscape {
        flex-direction: row !important;
        padding: 10px !important;
        max-width: 98vw !important;
        max-height: 90vh !important;
    }

    .swal-landscape .swal2-image {
        max-width: 50vw !important;
        max-height: 70vh !important;
    }

    .swal-landscape .swal2-actions {
        flex-direction: column !important;
        padding: 0 !important;
        min-width: 120px !important;
        max-width: 140px !important;
        gap: 8px !important;
    }

    .swal-landscape .swal2-confirm {
        width: 100% !important;
        max-width: 120px !important;
        font-size: 12px !important;
        padding: 6px 10px !important;
        margin: 0 !important;
    }

    .swal-landscape .swal2-cancel {
        width: 100% !important;
        max-width: 120px !important;
        font-size: 12px !important;
        padding: 6px 10px !important;
        margin: 0 !important;
    }
}

/* Ensure SweetAlert doesn't overflow on very small screens */
@media (max-width: 480px) {
    .swal2-popup {
        width: 98vw !important;
        max-width: 98vw !important;
        padding: 0.25rem !important;
        background: rgba(0, 0, 0, 0.9) !important;
        font-family: 'Inter', sans-serif !important;
    }

    .swal2-image {
        max-height: 50vh !important;
    }

    .swal2-title {
        font-size: 1rem !important;
        color: #ffffff !important;
        font-family: 'Inter', sans-serif !important;
        font-weight: 500 !important;
        letter-spacing: 0.2px !important;
    }

    /* Very small landscape */
    .swal-landscape .swal2-image {
        max-width: 45vw !important;
        max-height: 65vh !important;
    }

    .swal-landscape .swal2-actions {
        min-width: 100px !important;
        max-width: 120px !important;
        gap: 6px !important;
    }

    .swal-landscape .swal2-confirm {
        width: 100% !important;
        max-width: 100px !important;
        font-size: 11px !important;
        padding: 5px 8px !important;
        margin: 0 !important;
    }

    .swal-landscape .swal2-cancel {
        width: 100% !important;
        max-width: 100px !important;
        font-size: 11px !important;
        padding: 5px 8px !important;
        margin: 0 !important;
    }
}

/* Photo Gallery Styles */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.gallery-item-info {
    margin-top: 8px;
    text-align: center;
}

.gallery-timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
}

.swal-gallery-popup {
    max-width: 95vw !important;
    max-height: 90vh !important;
    background: rgba(0, 0, 0, 0.9) !important;
    border: 1px solid #333 !important;
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
}

.swal-gallery-landscape .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    max-height: 75vh;
}

/* Mobile responsive for gallery */
@media (max-width: 768px) {
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-height: 60vh;
    }
    
    .gallery-thumbnail {
        height: 100px;
    }
    
    .gallery-timestamp {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        max-height: 55vh;
    }
    
    .gallery-thumbnail {
        height: 80px;
    }
    
    .gallery-item {
        padding: 6px;
    }
}

/* Very small screens - landscape */
@media (max-width: 480px) and (orientation: landscape) {
    .photo-gallery {
        grid-template-columns: repeat(3, 1fr);
        max-height: 65vh;
    }
}

/* Gallery photo info styles */
.gallery-photo-info {
    margin-bottom: 1rem;
    text-align: center;
}

.gallery-photo-timestamp {
    font-size: 0.9rem;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Enhanced gallery photo modal styles */
.swal-responsive-popup .gallery-photo-info {
    order: -1;
    margin: 0 0 1rem 0;
}

/* Landscape specific styles for gallery photo info */
@media (orientation: landscape) and (max-height: 600px) {
    .gallery-photo-timestamp {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}

/* Mobile specific styles for gallery photo info */
@media (max-width: 768px) {
    .gallery-photo-timestamp {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* User name button - left side */
/* User name button - left side */
#user--name-change {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #000000, #1a1a1a);
    color: white;
    font-size: 26px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    text-align: center;
    box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 100;
}

#user--name-change:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #1a1a1a, #000000);
    border-color: rgba(255, 255, 255, 0.2);
}

#user--name-change:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px 0 rgba(0, 0, 0, 0.4);
}

/* Tooltip styles for buttons */
#camera--toggle::after {
    content: "Cambiar cámara";
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#camera--toggle:hover::after {
    opacity: 1;
}

#user--name-change::after {
    content: "Cambiar nombre";
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#user--name-change:hover::after {
    opacity: 1;
}

/* Button animations */
@keyframes buttonPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#camera--trigger:active {
    animation: buttonPulse 0.2s ease-in-out;
}

#camera--toggle:active,
#user--name-change:active {
    animation: buttonPulse 0.2s ease-in-out;
}

/* Improve button focus states for accessibility */
#camera--trigger:focus,
#camera--toggle:focus,
#user--name-change:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Ensure buttons work well with touch devices */
#camera--trigger,
#camera--toggle,
#user--name-change {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
    .button-container {
        bottom: 20px;
        padding: 12px 20px;
        max-width: 450px;
    }
    
    #camera--trigger {
        width: 210px;
        font-size: 16px;
        padding: 18px 22px;
        border-radius: 30px;
    }
    
    #camera--toggle {
        width: 60px;
        height: 60px;
    }
    
    #user--name-change {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    #camera--toggle::before {
        width: 20px;
        height: 20px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .button-container {
        bottom: 15px;
        padding: 10px 15px;
        max-width: 400px;
    }
    
    #camera--trigger {
        width: 190px;
        font-size: 14px;
        padding: 16px 20px;
        border-radius: 28px;
    }
    
    #camera--toggle {
        width: 55px;
        height: 55px;
    }
    
    #user--name-change {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    #camera--toggle::before {
        width: 18px;
        height: 18px;
    }
}

/* Portrait orientation - stack buttons vertically on very small screens */
@media (max-width: 320px) and (orientation: portrait) {
    .button-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        bottom: 20px;
        padding: 15px 10px;
        max-width: 280px;
        background: linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0%, transparent 100%);
        border-radius: 25px;
    }
    
    #camera--trigger {
        width: 170px;
        font-size: 13px;
        padding: 14px 18px;
        order: 2;
    }
    
    #camera--toggle {
        width: 50px;
        height: 50px;
        order: 3;
    }
    
    #user--name-change {
        width: 50px;
        height: 50px;
        font-size: 20px;
        order: 1;
    }
    
    #camera--toggle::before {
        width: 16px;
        height: 16px;
    }
}

/* Landscape orientation - optimize for landscape */
@media (orientation: landscape) and (max-height: 600px) {
    .button-container {
        bottom: 15px;
        padding: 10px 30px;
        max-width: 600px;
    }
    
    #camera--trigger {
        width: 190px;
        font-size: 15px;
        padding: 16px 20px;
        border-radius: 28px;
    }
    
    #camera--toggle {
        width: 55px;
        height: 55px;
    }
    
    #user--name-change {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}