:root {
    --bg-color: transparent;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --primary: #d4af37;
    --primary-hover: #b49126;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(212, 175, 55, 0.4);
    --card-bg: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.marble-background {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110vw;
    height: 110vh;
    z-index: -1;
    background-image: url('marble-bg.png');
    background-size: cover;
    background-position: center;
    animation: panMarble 40s ease-in-out infinite alternate;
    opacity: 0.9;
}

@keyframes panMarble {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-2%, -2%) scale(1.1); }
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.header-glass {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2.5rem 3rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    color: var(--text-color);
}

header h1 span {
    color: var(--primary);
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background: none;
}

header p.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.benefits-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.benefit-badge {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.benefit-badge:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(212, 175, 55, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.15);
}

.benefit-badge i {
    color: var(--primary);
}

/* Glassmorphism Panel (Liquid Glass) */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05), inset 0 0 20px rgba(255, 255, 255, 0.8);
    border-radius: 30px;
    padding: 3rem;
    transition: all 0.3s ease;
}

/* Upload Section */
.drop-zone {
    border: 1px dashed rgba(212, 175, 55, 0.5);
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.5s ease;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.3);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: rgba(212, 175, 55, 1);
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(212, 175, 55, 0.2);
}

.drop-zone .icon-container {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: transform 0.4s ease;
}

.drop-zone:hover .icon-container {
    transform: scale(1.1) translateY(-10px);
}

.drop-zone h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.drop-zone p {
    color: var(--text-muted);
}

/* Loading Section */
#loading-section {
    text-align: center;
    padding: 5rem 2rem;
}

.progress-container {
    max-width: 400px;
    margin: 0 auto 2rem auto;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.2);
    margin-bottom: 0.8rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #eab308);
    border-radius: 20px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.results-header h2 {
    font-size: 2rem;
    font-weight: 600;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-color);
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Page Groups */
.page-group {
    margin-bottom: 3.5rem;
}

.page-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-left: 4px;
}

/* Page group header with scan button */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-number {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.btn-scan-text, .btn-text-info, .btn-download-page {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-scan-text {
    background: rgba(212, 175, 55, 0.1);
    color: var(--primary);
    border: 1px solid rgba(212, 175, 55, 0.4);
}

.btn-text-info {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-download-page {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.btn-scan-text:hover:not(:disabled), .btn-text-info:hover, .btn-download-page:hover {
    transform: translateY(-1px);
}

.btn-scan-text:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--primary);
}

.btn-text-info:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--text-color);
}

.btn-download-page:hover {
    background: rgba(76, 175, 80, 0.25);
    border-color: #4caf50;
}

.btn-scan-text:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-scan-done {
    background: rgba(34, 197, 94, 0.1) !important;
    color: #16a34a !important;
    border-color: rgba(34, 197, 94, 0.4) !important;
}

/* Tile text tag indicator */
.tile-text-tag {
    font-size: 0.72rem;
    color: #fcd34d;
    margin-top: 4px;
}

/* Split Layout */
.split-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.portion-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.05);
}

.images-portion {
    flex: 2.5; /* Larger area for images */
}

.data-portion {
    flex: 1; /* Smaller area for specs */
    position: sticky;
    top: 2rem;
}

.portion-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

/* Data Table */
.data-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1.2fr;
    gap: 1rem;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    transition: background 0.2s;
}

.table-row:not(.table-header):hover {
    background: rgba(212, 175, 55, 0.05);
}

.table-header {
    font-weight: 700;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary);
    background: rgba(212, 175, 55, 0.08);
}

.col-name { 
    word-wrap: break-word;
}

@media (max-width: 1100px) {
    .split-container {
        flex-direction: column;
    }
    .data-portion {
        position: static;
        width: 100%;
    }
}

.meta-icon {
    font-size: 1rem;
}

.meta-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.meta-value {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Masonry Grid */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.tile-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    animation: fadeInUp 0.6s forwards;
    
    /* Force square medium cards */
    width: 100%;
    height: 280px; /* Explicit height instead of aspect-ratio */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

.tile-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.tile-card img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.7s ease;
}

.tile-card:hover img {
    transform: scale(1.05);
}

.tile-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.tile-card:hover .tile-overlay {
    transform: translateY(0);
    opacity: 1;
}

.tile-overlay p {
    font-size: 0.85rem;
    color: #fff;
    margin: 0;
    font-weight: 500;
}

.tile-overlay .dim {
    color: #94a3b8;
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Lightbox Modal */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 3rem;
    font-size: 3rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
    z-index: 1001;
}

.close-btn:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.lightbox-content {
    display: flex;
    gap: 3rem;
    max-width: 90%;
    max-height: 90%;
    align-items: center;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

#lightbox-img {
    max-width: 60vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
    padding: 2.5rem;
    min-width: 350px;
}

.lightbox-info h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    word-break: break-all;
    line-height: 1.3;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.info-item .label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-item .value {
    font-size: 1.2rem;
    font-weight: 500;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(212, 175, 55, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.2);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    .lightbox-content {
        flex-direction: column;
        overflow-y: auto;
        padding-top: 4rem;
        gap: 1.5rem;
    }
    
    #lightbox-img {
        max-width: 100%;
        max-height: 50vh;
    }
    
    .close-btn {
        top: 1rem;
        right: 1.5rem;
    }
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 1.5rem 2.5rem;
    margin: 4rem auto 0;
    max-width: fit-content;
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 30px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-main {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-links a:hover {
    color: var(--primary-hover);
}

.footer-rights {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header-glass {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    header h1 {
        font-size: 2.2rem;
    }

    header p.subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .benefit-badge {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-secondary {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .lightbox-info {
        min-width: auto;
        width: 100%;
        padding: 1.5rem;
    }

    .site-footer {
        padding: 1.5rem;
        width: 90%;
        max-width: none;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.8rem;
    }
}

.timer-display {
    margin: 1.5rem 0;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
}

#timer-text {
    font-family: 'Outfit', sans-serif;
    background: rgba(212, 175, 55, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}
/* Page Text Modal Styling */
.text-modal-container {
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 2.5rem !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(40px) !important;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.25) !important;
    animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

#text-modal-title {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

#text-modal-scroll-area {
    overflow-y: auto;
    padding-right: 1rem;
    flex-grow: 1;
}

#text-modal-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: var(--text-color);
    font-size: 1rem;
}

/* Custom Scrollbar for Modal */
#text-modal-scroll-area::-webkit-scrollbar {
    width: 8px;
}

#text-modal-scroll-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

#text-modal-scroll-area::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

#text-modal-scroll-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

@media (max-width: 600px) {
    .text-modal-container {
        padding: 1.5rem !important;
    }
    #text-modal-title {
        font-size: 1.4rem;
    }
}
