/**
 * WooCommerce Try On Frontend CSS.
 *
 * @package WooCommerce_Try_On
 */

/* Try On Button */
.tryloom-button {
    margin-left: 10px;
    vertical-align: middle;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.2);
    position: relative;
    overflow: hidden;
}

.tryloom-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
    pointer-events: none;
}

.tryloom-button:hover:before {
    left: 100%;
}

.tryloom-button > * {
    position: relative;
}

.tryloom-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.3);
}

/* Popup */
.tryloom-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    display: none;
}

.tryloom-popup.open {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    animation: tryloom-popup-fadein 0.3s ease forwards;
}

@keyframes tryloom-popup-fadein {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tryloom-popup-content {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    position: relative;
}

.tryloom-popup.open .tryloom-popup-content {
    transform: scale(1);
}

.tryloom-theme-dark .tryloom-popup-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
    color: #fff;
}
.tryloom-theme-dark .tryloom-popup-header,
.tryloom-theme-dark .tryloom-popup-body,
.tryloom-theme-dark .tryloom-result,
.tryloom-theme-dark .tryloom-account,
.tryloom-theme-dark .tryloom-upload-preview,
.tryloom-theme-dark .tryloom-popup-footer {
    color: #fff;
}
.tryloom-theme-dark .tryloom-history-table th,
.tryloom-theme-dark .tryloom-history-table td {
    color: #fff;
}
.tryloom-theme-dark .tryloom-popup-content input,
.tryloom-theme-dark .tryloom-popup-content select,
.tryloom-theme-dark .tryloom-popup-content button,
.tryloom-theme-dark .tryloom-generate,
.tryloom-theme-dark .tryloom-add-to-cart {
    background: #222851 !important;
    color: #fff !important;
    border-color: #444a6a;
}
.tryloom-theme-dark .tryloom-variation.selected {
    background: rgba(255,255,255,0.08) !important;
}

.tryloom-popup-header {
    padding: 25px 30px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.tryloom-theme-dark .tryloom-popup-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.tryloom-popup-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tryloom-theme-dark .tryloom-popup-header h3 {
    background: linear-gradient(135deg, #a8c0ff 0%, #c5a1ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tryloom-popup-close {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background-color: transparent !important;
}

.tryloom-popup-close:hover {
    transform: rotate(90deg) scale(1.2);
    color: #e53e3e;
    background-color: transparent !important;
}

.tryloom-theme-dark .tryloom-popup-close {
    color: #ccc;
}

.tryloom-theme-dark .tryloom-popup-close:hover {
    color: #ff6b6b;
}

.tryloom-popup-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    position: relative;
}

/* Custom Scrollbar */
.tryloom-popup-body::-webkit-scrollbar {
    width: 8px;
}

.tryloom-popup-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.tryloom-popup-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.tryloom-popup-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.tryloom-theme-dark .tryloom-popup-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.tryloom-theme-dark .tryloom-popup-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.tryloom-theme-dark .tryloom-popup-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Step 1 */
.tryloom-step {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.tryloom-upload {
    flex: 1;
    min-width: 300px;
}

.tryloom-variations {
    flex: 1;
    min-width: 300px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tryloom-popup-content {
        width: 95%;
    }
    
    .tryloom-popup-body {
        padding: 20px;
    }
    
    .tryloom-step {
        flex-direction: row;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .tryloom-upload,
    .tryloom-variations {
        flex: 1;
        min-width: calc(50% - 7.5px);
    }
    
    .tryloom-upload h4,
    .tryloom-variations h4 {
        font-size: 16px;
    }
    
    .tryloom-actions {
        flex-basis: 100%;
        margin-top: 15px;
        text-align: center;
    }
    
    .tryloom-result-image {
        padding: 15px;
    }
    
    .tryloom-image-actions {
        bottom: 15px;
        right: 15px;
    }
}

.tryloom-upload h4,
.tryloom-variations h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
}

.tryloom-theme-dark .tryloom-upload h4,
.tryloom-theme-dark .tryloom-variations h4 {
    color: #f7fafc;
}

.tryloom-upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 20px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tryloom-upload-area:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tryloom-upload-area:hover:before {
    opacity: 1;
}

.tryloom-upload-area:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
}

.tryloom-theme-dark .tryloom-upload-area {
    border-color: #4a5568;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.tryloom-theme-dark .tryloom-upload-area:hover {
    border-color: #a8c0ff;
}

.tryloom-upload-placeholder p {
    margin-top: 15px;
    color: #718096;
    font-size: 15px;
    font-weight: 500;
}

.tryloom-theme-dark .tryloom-upload-placeholder p {
    color: #cbd5e0;
}

.tryloom-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.tryloom-preview {
    max-width: 100%;
    max-height: 250px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.tryloom-preview img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.tryloom-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    color: #e53e3e;
    font-size: 20px;
    background-color: transparent !important;
}

.tryloom-remove-image:hover {
    transform: scale(1.2);
    color: #c53030;
    background-color: transparent !important;
}

.tryloom-remove-image svg,
.tryloom-remove-image i {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    font-size: 20px;
}

.tryloom-save-photo {
    margin-top: 15px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.tryloom-save-photo label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
}

.tryloom-theme-dark .tryloom-save-photo {
    background: rgba(168, 192, 255, 0.05);
    border-color: rgba(168, 192, 255, 0.1);
}

.tryloom-theme-dark .tryloom-save-photo label {
    color: #cbd5e0;
}

.tryloom-save-photo input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tryloom-variations-container {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
}

.tryloom-variations-container::-webkit-scrollbar {
    width: 6px;
}

.tryloom-variations-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.tryloom-variations-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.tryloom-theme-dark .tryloom-variations-container {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.tryloom-variation {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 15px;
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.tryloom-variation:hover {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(102, 126, 234, 0.03);
    transform: translateX(5px);
}

.tryloom-theme-dark .tryloom-variation {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.tryloom-theme-dark .tryloom-variation:hover {
    border-color: rgba(168, 192, 255, 0.3);
    background: rgba(168, 192, 255, 0.05);
}

.tryloom-variation.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.tryloom-theme-dark .tryloom-variation.selected {
    border-color: #a8c0ff;
    background: linear-gradient(135deg, rgba(168, 192, 255, 0.15) 0%, rgba(197, 161, 255, 0.15) 100%);
}

.tryloom-variation-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.tryloom-variation-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tryloom-variation-details {
    flex: 1;
}

.tryloom-variation-name {
    font-weight: 600;
    margin-bottom: 6px;
    color: #2d3748;
    font-size: 15px;
}

.tryloom-theme-dark .tryloom-variation-name {
    color: #f7fafc;
}

.tryloom-variation-price {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

.tryloom-theme-dark .tryloom-variation-price {
    color: #cbd5e0;
}

.tryloom-actions {
    margin-top: 30px;
    text-align: center;
    width: 100%;
}

.tryloom-generate,
.tryloom-retry,
.tryloom-add-to-cart,
.tryloom-download {
    padding: 14px 32px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Disabled button styles - only change color, don't make smaller */
.tryloom-generate:disabled,
.tryloom-retry:disabled,
.tryloom-add-to-cart:disabled,
.tryloom-download:disabled {
    background-color: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

.tryloom-generate:before,
.tryloom-add-to-cart:before,
.tryloom-download:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
    z-index: 0;
    pointer-events: none;
}

.tryloom-generate:hover:before,
.tryloom-add-to-cart:hover:before,
.tryloom-download:hover:before {
    left: 100%;
}

.tryloom-generate > *,
.tryloom-add-to-cart > *,
.tryloom-download > * {
    position: relative;
    z-index: 1;
}

.tryloom-generate:hover,
.tryloom-add-to-cart:hover,
.tryloom-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Disabled buttons should not have hover effects */
.tryloom-generate:disabled:hover,
.tryloom-add-to-cart:disabled:hover,
.tryloom-download:disabled:hover {
    transform: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

.tryloom-retry {
    background: #f7fafc;
    color: #4a5568;
    position: relative;
    overflow: hidden;
}

.tryloom-retry:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
    z-index: 0;
    pointer-events: none;
}

.tryloom-retry:hover:before {
    left: 100%;
}

.tryloom-retry > * {
    position: relative;
    z-index: 1;
}

.tryloom-retry:hover {
    background: #edf2f7;
    transform: translateY(-2px);
}

.tryloom-theme-dark .tryloom-retry {
    background: #2d3748;
    color: #cbd5e0;
}

.tryloom-theme-dark .tryloom-retry:hover {
    background: #4a5568;
}

/* Step 2 */
.tryloom-result {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.tryloom-result-image {
    margin-bottom: 30px;
    width: 100%;
    max-width: 600px;
    padding: 20px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 360px;
}

.tryloom-theme-dark .tryloom-result-image {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.tryloom-result-image img {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s ease;
}

.tryloom-result-image.is-loading img {
    opacity: 0;
}

.tryloom-result-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(247, 250, 252, 0.85);
    border-radius: inherit;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 6;
}

.tryloom-theme-dark .tryloom-result-loading {
    background: rgba(26, 32, 44, 0.85);
}

.tryloom-result-loading.is-active {
    opacity: 1;
    visibility: visible;
}

.tryloom-image-actions {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 15px;
    z-index: 5;
}

.tryloom-icon-button {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    border: none;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #667eea;
    background-color: transparent !important;
}

.tryloom-icon-button:hover {
    transform: scale(1.1);
    color: #764ba2;
    background-color: transparent !important;
}

.tryloom-icon-button svg,
.tryloom-icon-button i {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    font-size: 18px;
}

.tryloom-download-icon {
    color: #667eea;
}

.tryloom-download-icon:hover {
    color: #764ba2;
}

.tryloom-download-icon:hover svg,
.tryloom-download-icon:hover i {
    color: #764ba2;
}

.tryloom-retry-icon {
    color: #718096;
}

.tryloom-retry-icon:hover {
    color: #4a5568;
}

.tryloom-theme-dark .tryloom-icon-button {
    color: #a8c0ff;
}

.tryloom-theme-dark .tryloom-retry-icon:hover {
    color: #cbd5e0;
}

.tryloom-result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

/* Loading Overlay */
.tryloom-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);  /* Light theme overlay */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

.tryloom-theme-dark .tryloom-loading-overlay {
    background: rgba(26, 32, 44, 0.95);  /* Dark theme overlay */
}

.tryloom-spinner {
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    border-top: 4px solid #667eea;
    width: 50px;
    height: 50px;
    animation: tryloom-spin 1s linear infinite;
    margin-bottom: 20px;
}

.tryloom-theme-dark .tryloom-spinner {
    border-color: rgba(168, 192, 255, 0.1);
    border-top-color: #a8c0ff;
}

.tryloom-loading-overlay p {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;  /* Dark text for light theme */
    margin: 0;
}

.tryloom-theme-dark .tryloom-loading-overlay p {
    color: #f7fafc;  /* Light text for dark theme */
}

@keyframes tryloom-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Upload Progress */
.tryloom-upload-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 5;
}

.tryloom-theme-dark .tryloom-upload-progress-overlay {
    background: rgba(26, 32, 44, 0.95);
}

.tryloom-progress-circle {
    width: 80px;
    height: 80px;
    position: relative;
}

.tryloom-progress-circle svg {
    transform: rotate(-90deg);
}

.tryloom-progress-circle-bg {
    fill: none;
    stroke: rgba(102, 126, 234, 0.1);
    stroke-width: 8;
}

.tryloom-progress-circle-fill {
    fill: none;
    stroke: #667eea;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.tryloom-theme-dark .tryloom-progress-circle-fill {
    stroke: #a8c0ff;
}

.tryloom-progress-text {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
}

.tryloom-theme-dark .tryloom-progress-text {
    color: #cbd5e0;
}

.tryloom-progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

.tryloom-theme-dark .tryloom-progress-percent {
    color: #a8c0ff;
}

/* Account Page */
.tryloom-upload-new-photo-section {
    margin: 20px 0 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
}

.tryloom-upload-photo-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border: none !important;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tryloom-upload-photo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.tryloom-history-actions {
    margin: 20px 0;
    text-align: right;
}

.tryloom-delete-all-history {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border: 2px solid rgba(229, 62, 62, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tryloom-delete-all-history:hover {
    background: rgba(229, 62, 62, 0.2);
    transform: translateY(-2px);
}

.tryloom-delete-history {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border: 1px solid rgba(229, 62, 62, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tryloom-delete-history:hover {
    background: rgba(229, 62, 62, 0.2);
    transform: translateY(-2px);
}

.tryloom-account-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.tryloom-account-photo {
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.tryloom-account-photo:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.tryloom-account-photo.is-default {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
}

.tryloom-account-photo.is-default:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    pointer-events: none;
    z-index: 1;
}

.tryloom-account-photo-image {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    position: relative;
    overflow: hidden;
}

.tryloom-account-photo-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.tryloom-account-photo-actions {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(247, 250, 252, 0.8);
    backdrop-filter: blur(10px);
    gap: 10px;
}

.tryloom-account-photo-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tryloom-set-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tryloom-set-default:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tryloom-delete {
    background: rgba(0, 0, 0, 0.05);
    color: #e53e3e;
}

.tryloom-delete:hover {
    background: rgba(229, 62, 62, 0.1);
    transform: translateY(-2px);
}

.tryloom-default-label {
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tryloom-history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
}

.tryloom-history-table th,
.tryloom-history-table td {
    padding: 16px;
    text-align: left;
}

.tryloom-history-table thead tr {
    background: transparent;
    color: inherit;
}

.tryloom-history-table th {
    font-weight: 600;
    text-transform: none;
    font-size: 14px;
    letter-spacing: normal;
}

.tryloom-history-table th:first-child {
    border-radius: 10px 0 0 10px;
}

.tryloom-history-table th:last-child {
    border-radius: 0 10px 10px 0;
}

.tryloom-history-table tbody tr {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.tryloom-history-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tryloom-history-table td:first-child {
    border-radius: 10px 0 0 10px;
}

.tryloom-history-table td:last-child {
    border-radius: 0 10px 10px 0;
}

.tryloom-history-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.tryloom-history-image img:hover {
    transform: scale(1.1);
}

.tryloom-upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    transform: scale(1.02);
}

.tryloom-theme-dark .tryloom-upload-area.dragover {
    border-color: #a8c0ff;
    background: linear-gradient(135deg, rgba(168, 192, 255, 0.15) 0%, rgba(197, 161, 255, 0.15) 100%);
}

.tryloom-upload-placeholder svg {
    opacity: 0.5;
    transition: all 0.3s ease;
}

.tryloom-upload-area:hover .tryloom-upload-placeholder svg {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Responsive */
@media screen and (max-width: 600px) {
    .tryloom-popup-content {
        width: 95%;
        max-height: 80vh;
        border-radius: 16px;
        display: flex;
        flex-direction: column;
    }
    
    .tryloom-popup-header {
        padding: 20px;
        flex-shrink: 0;
    }
    
    .tryloom-popup-header h3 {
        font-size: 20px;
    }
    
    .tryloom-popup-body {
        padding: 20px;
        padding-bottom: 80px; /* Space for fixed button */
        flex: 1;
        overflow-y: auto;
    }
    
    .tryloom-step {
        flex-direction: column;
        gap: 25px;
    }
    
    .tryloom-upload,
    .tryloom-variations {
        min-width: 100%;
    }
    
    /* Fixed Generate Button at Bottom */
    .tryloom-step-1 .tryloom-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
        backdrop-filter: blur(10px);
        padding: 15px 20px;
        margin: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .tryloom-theme-dark .tryloom-step-1 .tryloom-actions {
        background: linear-gradient(to top, rgba(26, 32, 44, 0.98) 0%, rgba(26, 32, 44, 0.95) 100%);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .tryloom-step-1 .tryloom-actions .tryloom-generate {
        width: 100%;
        margin: 0;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    /* Fixed Add to Cart Button at Bottom for Step 2 */
    .tryloom-step-2 .tryloom-result-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
        backdrop-filter: blur(10px);
        padding: 15px 20px;
        margin: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        flex-direction: column;
        gap: 10px;
    }
    
    .tryloom-theme-dark .tryloom-step-2 .tryloom-result-actions {
        background: linear-gradient(to top, rgba(26, 32, 44, 0.98) 0%, rgba(26, 32, 44, 0.95) 100%);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .tryloom-step-2 .tryloom-result-actions .button,
    .tryloom-step-2 .tryloom-result-actions a {
        width: 100%;
        margin: 0;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .tryloom-result-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .tryloom-result-actions .button,
    .tryloom-result-actions a {
        width: 100%;
        margin: 0;
    }
    
    .tryloom-account-photos {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}
/* Pagination Styles */
.tryloom-pagination {
    margin: 20px 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tryloom-page-link,
.tryloom-current-page {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.tryloom-page-link {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.tryloom-page-link:hover {
    background: #e2e8f0;
    color: #2d3748;
    border-color: #cbd5e0;
}

.tryloom-current-page {
    background: #667eea;
    color: white;
    border: 1px solid #667eea;
}

.tryloom-theme-dark .tryloom-page-link {
    background: #2d3748;
    color: #cbd5e0;
    border: 1px solid #4a5568;
}

.tryloom-theme-dark .tryloom-page-link:hover {
    background: #4a5568;
    color: #f7fafc;
    border-color: #718096;
}

.tryloom-theme-dark .tryloom-current-page {
    background: #667eea;
    color: white;
    border: 1px solid #667eea;
}

/* Font Awesome icon styling */
.tryloom-history-actions .button i,
.tryloom-delete-history i,
.tryloom-generate i,
.tryloom-download i,
.tryloom-retry i,
.tryloom-add-to-cart i {
    margin-right: 6px;
    font-size: 14px;
}

/* Lightbox Styles */
.tryloom-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.tryloom-lightbox.open {
    display: flex;
}

.tryloom-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}

.tryloom-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.tryloom-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.tryloom-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Make history images clickable for lightbox */
.tryloom-history-image {
    display: inline-block;
    cursor: pointer;
}

.tryloom-history-image img {
    transition: transform 0.3s ease;
}

.tryloom-history-image:hover img {
    transform: scale(1.05);
}

/* Result image in popup also clickable for lightbox */
.tryloom-result-image {
    cursor: pointer;
}

/* Unify popup buttons with main try-on button */
.tryloom-button,
.tryloom-generate,
.tryloom-add-to-cart {
    margin-left: 10px;
    vertical-align: middle;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.2);
    position: relative;
    overflow: hidden;
}

/* Remove shine animation */
.tryloom-button:before,
.tryloom-generate:before,
.tryloom-add-to-cart:before {
    content: none !important;
    display: none !important;
}

/* Keep a subtle hover without shine */
.tryloom-button:hover,
.tryloom-generate:hover,
.tryloom-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.3);
}

/* Icon buttons - no hover background, even in dark theme */
.tryloom-icon-button,
.tryloom-icon-button:hover,
.tryloom-theme-dark .tryloom-icon-button,
.tryloom-theme-dark .tryloom-icon-button:hover {
    background: transparent !important;
    box-shadow: none !important;
}

/* Ensure dark theme buttons still readable; colors handled inline or above */
.tryloom-theme-dark .tryloom-generate,
.tryloom-theme-dark .tryloom-add-to-cart {
    color: #fff !important;
}

/* * This is the standard WordPress class to hide text visually 
 * but keep it for screen readers.
 */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}






/* --- 1. Main Table Styling --- */
/* Prefixes with .tryloom-account-history to be specific */
.tryloom-account-history .tryloom-history-table {
    width: 100%;
    border-collapse: collapse; /* Clean, single borders */
    margin-top: 1.5em;
    font-size: 1rem;
    color: #333;
}

/* --- 2. Table Header --- */
.tryloom-history-table th {
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    padding: 12px 15px;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

/* --- 3. Table Body & Rows --- */
.tryloom-history-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease-in-out;
}

/* Add a subtle hover effect to the rows */
.tryloom-history-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* --- 4. Table Cells (Data and Header) --- */
.tryloom-history-table th,
.tryloom-history-table td {
    padding: 16px 15px;
    vertical-align: middle;
    line-height: 1.5;
}

/* --- 5. Image Style (Desktop default) --- */
.tryloom-history-table td img {
    display: block; /* Typically block for desktop layout */
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* --- 6. Action Button Styles --- */
.tryloom-history-table td .button {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 4px;
    margin: 0 4px;
    text-decoration: none;
    line-height: 1;
}

/* --- 7. Icon Styling --- */
.tryloom-history-table td .button .fas {
    font-size: 1.4em;
    color: #888;
    transition: all 0.2s ease-in-out;
}

/* Download button hover */
.tryloom-history-table td .button[download]:hover .fas {
    color: #552FBC;
    transform: scale(1.15);
}

/* Try Again button hover */
.tryloom-history-table td .button:not([download]):not(.tryloom-delete-history):hover .fas {
    color: #2271b1;
    transform: scale(1.15);
}

/* Delete button hover */
.tryloom-history-table td .button.tryloom-delete-history:hover .fas {
    color: #d63638;
    transform: scale(1.15);
}

/* --- 8. General History Action Buttons --- */
.tryloom-history-actions {
    margin-bottom: 20px;
}

.tryloom-history-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tryloom-delete-history {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* --- 9. Responsive (Mobile) Table Styles --- */
/* These styles will only apply on screens 768px or smaller */
@media (max-width: 768px) {
    .tryloom-history-table,
    .tryloom-history-table thead,
    .tryloom-history-table tbody,
    .tryloom-history-table th,
    .tryloom-history-table td,
    .tryloom-history-table tr {
        display: block;
    }

    .tryloom-history-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .tryloom-history-table tbody tr {
        margin-bottom: 20px;
        border-radius: 12px;
        border: 1px solid #e0e0e0; /* Optional: Add border for card effect */
    }

    .tryloom-history-table td {
        border: none;
        border-bottom: 1px solid #f0f0f0; /* Separator line between fields */
        position: relative;
        padding-left: 50%;
        text-align: right; /* Default for mobile cells */
    }

    /* Mobile specific style for the image column to align content to the right */
    .tryloom-history-table td:nth-of-type(3) { /* Target the Image column */
        text-align: right;
    }

    /* Ensure image respects text-align in mobile view */
    .tryloom-history-table td:nth-of-type(3) img {
        display: inline-block; /* Change to inline-block to allow text-align to work */
    }


    .tryloom-history-table td:before {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 16px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 700;
        text-align: left;
        color: #4a5568;
    }

    .tryloom-history-table td:nth-of-type(1):before { content: "Date"; }
    .tryloom-history-table td:nth-of-type(2):before { content: "Product"; }
    .tryloom-history-table td:nth-of-type(3):before { content: "Image"; }
    .tryloom-history-table td:nth-of-type(4):before { content: "Actions"; }

    .tryloom-history-table td:last-child {
        border-bottom: none; /* No line for the last item in the card */
    }

    .tryloom-history-table tbody tr td:first-child {
        border-radius: 12px 12px 0 0;
    }

    .tryloom-history-table tbody tr td:last-child {
        border-radius: 0 0 12px 12px;
    }
}