/* ============================================
   AstraMinds Digital Catalog Viewer
   Modern, Stunning, Visually Appealing Design
   Primary Color: #008E74
   ============================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #008E74;
    --primary-dark: #006b56;
    --primary-light: #00b894;
    --primary-alpha: rgba(0, 142, 116, 0.1);
    --secondary-color: #2c3e50;
    --text-dark: #222222;
    --text-gray: #666666;
    --text-light: #999999;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-glass: rgba(255, 255, 255, 0.95);
    --border-color: #e0e4e8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8ecef 100%);
    color: var(--text-dark);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Loader */
.loader-container {
    position: fixed;
    inset: 0;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loader-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    text-align: center;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader p {
    font-size: 16px;
    color: var(--text-gray);
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Header */
.header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 142, 116, 0.2);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.logo-icon {
    color: white;
    font-size: 24px;
    font-weight: 700;
}

.brand-text h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    line-height: 1;
}

.subtitle {
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(0, 142, 116, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 142, 116, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Main Viewer Container */
.viewer-container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 30px;
}

/* Top Controls */
.controls-top {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.catalog-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.catalog-badge {
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Navigation Controls */
.navigation-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-light);
    padding: 8px 15px;
    border-radius: var(--radius-lg);
}

.nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-white);
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.nav-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 142, 116, 0.3);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.page-input {
    width: 50px;
    padding: 6px 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-white);
}

.page-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-alpha);
}

.page-separator {
    color: var(--text-light);
    font-size: 18px;
}

.page-total {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-gray);
}

/* View Controls */
.view-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-light);
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: var(--primary-alpha);
    color: var(--primary-color);
    transform: scale(1.1);
}

.zoom-level {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray);
    min-width: 45px;
    text-align: center;
}

/* PDF Viewer */
.pdf-viewer-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-light);
    overflow: auto;
}

#pdfCanvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: auto;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.page-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.page-loading.active {
    display: flex;
}

.page-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    position: absolute;
    inset: 0;
    display: none;
    pointer-events: none;
}

.mobile-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 100px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.mobile-nav:hover {
    opacity: 1;
}

.mobile-prev {
    left: 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.mobile-next {
    right: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* Bottom Controls */
.controls-bottom {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 20px 30px;
    margin-top: 20px;
    box-shadow: var(--shadow-md);
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-dark);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-alpha);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Thumbnail Strip */
.thumbnail-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
}

.thumbnail-strip::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-strip::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 10px;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.thumbnail {
    min-width: 80px;
    height: 100px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.thumbnail.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-alpha);
}

.thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-number {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-light);
    color: var(--text-gray);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #ff6b6b;
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.share-text {
    margin-bottom: 16px;
    color: var(--text-gray);
}

.share-text span {
    font-weight: 600;
    color: var(--primary-color);
}

.share-url-container {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.share-url {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-light);
    color: var(--text-dark);
}

.copy-btn {
    padding: 0 16px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.social-share {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.social-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.social-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.social-btn.whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
}

.social-btn.facebook {
    background: linear-gradient(135deg, #1877f2, #0c63d4);
}

.social-btn.twitter {
    background: linear-gradient(135deg, #1da1f2, #0c85d0);
}

.social-btn.email {
    background: linear-gradient(135deg, #ea4335, #d33b2c);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-dark);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: var(--transition);
    z-index: 3000;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    color: #4caf50;
    font-size: 18px;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    gap: 8px;
    z-index: 1000;
}

.mobile-menu-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--bg-light);
    color: var(--text-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.mobile-menu-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-container,
    .viewer-container {
        padding: 0 20px;
    }

    .controls-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .navigation-controls {
        justify-content: center;
    }

    .view-controls {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 15px;
    }

    .brand-text h1 {
        font-size: 20px;
    }

    .btn-text {
        display: none;
    }

    .btn {
        padding: 10px 12px;
    }

    .controls-top {
        padding: 15px;
    }

    .catalog-title {
        font-size: 16px;
    }

    .pdf-viewer-wrapper {
        min-height: 400px;
    }

    .mobile-nav-overlay {
        display: block;
    }

    .action-buttons {
        display: none;
    }

    .mobile-menu {
        display: flex;
    }

    .thumbnail-strip {
        display: none;
    }
}

@media (max-width: 480px) {
    .view-controls {
        display: none;
    }

    .header-actions {
        display: none;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

/* Print Styles */
@media print {
    .header,
    .controls-top,
    .controls-bottom,
    .mobile-menu,
    .mobile-nav-overlay {
        display: none !important;
    }

    .pdf-viewer-wrapper {
        box-shadow: none;
        border-radius: 0;
    }

    #pdfCanvas {
        box-shadow: none;
        max-width: 100%;
    }
}