/**
 * Live Shot Pro - Frontend Gallery Styles
 * Modern gallery design with hover effects
 */

/* Font Declaration */
@font-face {
    font-family: 'Cabira Bold';
    src: url('../fonts/cabira-bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

a:focus, a:hover {
    outline: none;
    text-decoration: none;
    box-shadow: none !important;
}

/* Apply Cabira Bold to all headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cabira Bold', Arial, sans-serif;
    font-weight: bold;
}

/* Gallery Container */
.lsp-scroll-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
}

.lsp-gallery-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    margin: 0 auto;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .lsp-gallery-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .lsp-gallery-container {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* Photo Item */
.photo-item {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: 100%;
    aspect-ratio: 1 / 1; /* Make all items square for consistent grid */
}

.photo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Gradient overlay - only on hover */
.photo-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(220, 38, 38, 0.7) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item:hover::before {
    opacity: 1;
}

/* Remove loading placeholder */
.photo-item .lsp-placeholder {
    display: none !important;
}

.photo-item.loading .lsp-placeholder {
    display: none !important;
}

/* Main Image */
.photo-item img.lsp-lazy {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.photo-item:hover img.lsp-lazy {
    transform: scale(1.02);
}

/* Logo on top left - smaller, visible on hover */
.photo-item .photo-logo {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 50px;
    height: auto;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.photo-item:hover .photo-logo {
    opacity: 0.9;
}

/* Resize icon on top right */
.photo-item .photo-resize {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    cursor: zoom-in;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    pointer-events: auto;
}

.photo-item:hover .photo-resize {
    opacity: 1;
}

/* Overlay Container */
.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

/* Action Buttons Container */
.photo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Button Styles */
.photo-actions button {
    border: none;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Download Free Button - White background, black text */
.photo-download-free {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #000 !important;
}

.photo-download-free:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Buy Buttons - Black background, white text */
.photo-add-cart {
    background: rgba(0, 0, 0, 0.9) !important;
    color: #fff !important;
}

.photo-add-cart:hover {
    background: rgba(0, 0, 0, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Price in buttons - Red color */
.photo-add-cart .price {
    font-weight: 700;
    margin-left: 5px;
    color: #ff1f00;
}

/* View Cart Button (when item is added) */
.view-cart-button {
    background: rgba(0, 0, 0, 0.9) !important;
    color: white !important;
    width: 100%;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    backdrop-filter: blur(10px);
}

.view-cart-button:hover {
    background: rgba(0, 0, 0, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Success message */
.lsp-success-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 10;
    opacity: 0;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Loading state */
.photo-item.loading img {
    opacity: 0;
}

.photo-item img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Fancybox customization */
.fancybox__container {
    --fancybox-bg: rgba(0, 0, 0, 0.9);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .photo-item .photo-logo {
        width: 40px;
        top: 5px;
        left: 5px;
    }
    
    .photo-item .photo-resize {
        top: 5px;
        right: 5px;
    }
    
    .photo-actions button {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .photo-overlay {
        padding: 10px;
    }
}

/* Remove absolute positioning for masonry layout */
.photo-item img.lsp-lazy {
    position: relative !important;
}

/* Keep logos and resize icons positioned */
.photo-item .photo-logo,
.photo-item .photo-resize {
    position: absolute !important;
}

/* Cart Page Styles */
.lsp-cart-container {
    max-width: 1200px;
    margin: 50px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.lsp-cart-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.lsp-cart-header h1 {
    font-size: 32px;
    color: #333;
    margin: 0;
}

/* Fix button text wrapping */
.photo-actions button {
    white-space: nowrap;
    min-width: 200px;
}

/* Download icon in button */
.photo-download-free img {
    width: auto !important;
    height: 1.2rem !important;
    margin-left: 0.3rem !important;
    filter: invert(1); /* Make icon black */
}

/* Disabled state */
.photo-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Spinner */
.lsp-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.lsp-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #ff1f00;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: lsp-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes lsp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cart Sidebar Styles */

/* Cart Toggle Button */
.lsp-cart-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ff1f00;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: all 0.3s ease;
    z-index: 1000;
}

.lsp-cart-toggle:hover {
    background: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(229, 57, 53, 0.3);
    color: #ff1f00;
}

.lsp-cart-toggle svg {
    width: 24px;
    height: 24px;
}

/* Cart Count Badge */
.lsp-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #000;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.lsp-cart-count.has-items {
    display: flex;
}

/* Cart Overlay */
.lsp-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lsp-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Cart Sidebar */
.lsp-cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 1002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lsp-cart-sidebar.active {
    right: 0;
    z-index: 9999;
}

/* Cart Header */
.lsp-cart-sidebar .lsp-cart-header {
    padding: 24px;
    border-bottom: 2px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
}

.lsp-cart-sidebar .lsp-cart-header h2 {
    margin: 0;
    font-size: 22px;
    color: #fff;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.lsp-cart-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.lsp-cart-close:hover {
    background: rgba(255,255,255,0.1);
    color: #ff1f00;
}

/* Cart Items */
.lsp-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #fafafa;
}

.lsp-cart-empty {
    text-align: center;
    padding: 80px 20px;
}

.lsp-cart-empty svg {
    width: 80px;
    height: 80px;
    stroke: #e0e0e0;
    margin-bottom: 24px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.lsp-cart-empty p {
    color: #757575;
    font-size: 18px;
    font-weight: 500;
}

/* Cart Item */
.lsp-cart-sidebar .lsp-cart-item {
    display: flex;
    padding: 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}

.lsp-cart-sidebar .lsp-cart-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.lsp-cart-item-image {
    width: 80px;
    height: 80px;
    margin-right: 16px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 6px;
}

.lsp-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lsp-cart-item-details {
    flex: 1;
    padding-right: 8px;
}

.lsp-cart-item-details h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #000;
    font-weight: 600;
    line-height: 1.3;
}

.lsp-cart-item-type {
    color: #616161;
    font-size: 13px;
    margin: 0 0 8px;
    font-weight: 500;
}

.lsp-cart-item-price {
    font-weight: 700;
    color: #ff1f00;
    margin: 0;
    font-size: 16px;
}

.lsp-cart-item-remove {
    background: none;
    border: none;
    color: #bdbdbd;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-left: 10px;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.lsp-cart-item-remove:hover {
    color: #ff1f00;
    transform: scale(1.2);
}

/* Cart Footer */
.lsp-cart-footer {
    border-top: 2px solid #f5f5f5;
    padding: 24px;
    background: white;
}

.lsp-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 24px;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
}

.lsp-cart-total span:first-child {
    color: #424242;
    font-weight: 600;
}

.lsp-cart-total-amount {
    color: #000;
    font-size: 24px;
}

/* Cart Buttons */
.lsp-checkout-button,
.lsp-clear-cart-button {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lsp-checkout-button {
    background: #ff1f00;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.2);
}

.lsp-checkout-button:hover {
    background: #d32f2f;
    box-shadow: 0 6px 16px rgba(229, 57, 53, 0.3);
    transform: translateY(-1px);
}

.lsp-clear-cart-button {
    background: transparent;
    color: #757575;
    border: 2px solid #e0e0e0;
}

.lsp-clear-cart-button:hover {
    background: #000;
    color: white;
    border-color: #000;
}

/* New Photo Animation for Grid */
.photo-item.new-photo {
    animation: gridFadeIn 0.5s ease-out;
}

.photo-item.new-photo-highlight {
    box-shadow: 0 0 0 3px #ff1f00;
}

@keyframes gridFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Cart Item Animation */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.lsp-cart-sidebar .lsp-cart-item {
    animation: slideInFromRight 0.3s ease-out;
}

/* Scrollbar Styling */
.lsp-cart-items::-webkit-scrollbar {
    width: 6px;
}

.lsp-cart-items::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.lsp-cart-items::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 3px;
}

.lsp-cart-items::-webkit-scrollbar-thumb:hover {
    background: #bdbdbd;
}

/* Responsive Cart */
@media screen and (max-width: 480px) {
    .lsp-cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .lsp-cart-toggle {
        width: 48px;
        height: 48px;
    }
    
    .lsp-cart-sidebar .lsp-cart-header {
        padding: 20px;
    }
    
    .lsp-cart-items {
        padding: 16px;
    }
    
    .lsp-cart-footer {
        padding: 20px;
    }
}

/* Real-time sync indicator */
.lsp-sync-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(26, 26, 26, 0.95);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}

.lsp-sync-indicator.active {
    transform: translateY(0);
    opacity: 1;
}

.lsp-sync-indicator .sync-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lsp-sync-indicator .sync-icon {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.lsp-sync-indicator .sync-text {
    font-size: 14px;
    font-weight: 500;
}

.lsp-sync-indicator .sync-progress {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 8px;
}

/* New photo highlight animation */
.photo-item.new-photo-highlight {
    position: relative;
    overflow: visible;
}

.photo-item.new-photo-highlight::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 3px solid #00ff88;
    border-radius: inherit;
    animation: highlight-pulse 2s ease-out;
    pointer-events: none;
    z-index: 10;
}

@keyframes highlight-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
    }
    50% {
        transform: scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Gallery photo count animation */
.gallery-photo-count {
    transition: all 0.3s ease;
}

.gallery-photo-count.count-updated {
    animation: count-pulse 1s ease;
}

@keyframes count-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); color: #00ff88; }
}

/* Smooth photo append animation */
.photo-item.new-photo {
    animation: photo-appear 0.5s ease-out;
}

@keyframes photo-appear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Spin animation for sync icon */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Watermark Styles */
.lsp-watermark {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lsp-watermark-logo {
    max-height: 40px;
    max-width: 150px;
    width: auto;
    height: auto;
}

.lsp-watermark-text {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    white-space: nowrap;
}

/* Watermark positioning */
.lsp-watermark-top-left {
    top: 10px;
    left: 10px;
}

.lsp-watermark-top-right {
    top: 10px;
    right: 10px;
}

.lsp-watermark-bottom-left {
    bottom: 10px;
    left: 10px;
}

.lsp-watermark-bottom-right {
    bottom: 10px;
    right: 10px;
}

.lsp-watermark-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Ensure watermark shows above image but below overlays */
.photo-item {
    position: relative;
}

.photo-item .lsp-watermark {
    z-index: 2;
}

.photo-item .photo-overlay {
    z-index: 3;
}

.photo-item .photo-logo,
.photo-item .photo-resize {
    z-index: 4;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .lsp-watermark-logo {
        max-height: 30px;
        max-width: 100px;
    }
    
    .lsp-watermark-text {
        font-size: 12px;
    }
}

/* Fancybox watermark styles */
.fancybox__content .lsp-watermark {
    position: absolute;
    z-index: 10;
}

.fancybox__content .lsp-watermark-logo {
    max-height: 60px;
    max-width: 200px;
}

.fancybox__content .lsp-watermark-text {
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Ensure Fancybox content is relatively positioned */
.fancybox__content {
    position: relative !important;
}

/* Larger watermarks in lightbox on desktop */
@media (min-width: 1024px) {
    .fancybox__content .lsp-watermark-logo {
        max-height: 80px;
        max-width: 250px;
    }
    
    .fancybox__content .lsp-watermark-text {
        font-size: 22px;
    }
}

/* Image Protection Styles */
.lsp-gallery-container img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    user-drag: none;
    pointer-events: auto;
}

/* Disable image highlighting */
.lsp-gallery-container img::selection {
    background: transparent;
}

.lsp-gallery-container img::-moz-selection {
    background: transparent;
}

/* Protection tooltip */
.lsp-protection-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10000;
    pointer-events: none;
    display: none;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lsp-protection-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(0, 0, 0, 0.9);
}

/* Real-time sync notification */
.lsp-sync-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.lsp-sync-notification.show {
    transform: translateX(0);
}

.lsp-sync-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lsp-sync-notification svg {
    flex-shrink: 0;
}

/* Gallery reloading state */
.lsp-gallery-container.lsp-reloading {
    position: relative;
    opacity: 0.6;
}

.lsp-gallery-container.lsp-reloading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: lsp-spin 1s linear infinite;
}

@keyframes lsp-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
