/* Main Application Styles */

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.header {
    background: linear-gradient(90deg, #ff9a00, #ff6f00);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-left h1 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.2rem;
}

.credits {
    font-size: 0.8rem;
    opacity: 0.9;
    font-style: italic;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right.session-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #666;
    flex-wrap: nowrap;
    max-width: 400px;
}

.status-info {
    font-size: 0.9rem;
    text-align: right;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.left-panel {
    width: 100%;
    max-width: 400px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.controls {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.pdf-status {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #2e7d32;
}

.pdf-count {
    font-weight: bold;
    color: #1b5e20;
}

.results-panel {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

.result-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-item:hover {
    background: #f0f8ff;
    border-color: #ff9a00;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.result-item.selected {
    background: #fff3e0;
    border-color: #ff9a00;
    border-width: 2px;
}

.result-page {
    font-weight: bold;
    color: #ff9a00;
    font-size: 0.9rem;
}

.result-context {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.result-file {
    color: #007bff;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
}

.viewer-controls {
    padding: 0;
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.viewer-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff9a00, #ff6f00);
}

.controls-left {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 0.25rem;
}

.controls-right {
    margin-left: auto;
    padding: 0.5rem 1rem;
}

.zoom-label {
    background: #555;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.pdf-viewer {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #f0f0f0;
}

.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
    color: white;
    text-align: center;
    padding: 2rem;
}

.welcome-logo {
    width: 80px;
    height: 80px;
    background: #ff9a00;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 8px 25px rgba(255, 154, 0, 0.3);
}

.welcome-logo::before {
    content: "🏢";
    font-size: 2.5rem;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.welcome-subtitle {
    font-size: 1.1rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    line-height: 1.4;
}

.welcome-features {
    display: flex;
    gap: 2rem;
    max-width: 800px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.welcome-feature {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.welcome-feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.welcome-feature-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.welcome-feature-desc {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.3;
}

.pdf-loaded .welcome-screen {
    display: none;
}

.session-info {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    max-width: 400px;
}

.session-timer {
    color: #ff9a00;
    font-weight: bold;
    white-space: nowrap;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    margin-left: 0.5rem;
}

.logout-btn:hover {
    background: #c0392b;
}

.online-status-session {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.session-timer-container {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #e0e0e0;
}

.pdf-mobile-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #e0e0e0;
    overflow: hidden;
}

.pdf-mobile-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    transform-origin: top left;
    object-fit: contain;
}

.mobile-highlights {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.mobile-highlight-circle {
    position: absolute;
    border: 4px solid #00ff00;
    border-radius: 50%;
    pointer-events: none;
    z-index: 11;
    animation: pulse 2s infinite;
}

.mobile-highlight-pointer {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid #00ff00;
    pointer-events: none;
    z-index: 12;
    animation: bounce 1s infinite;
}

.pdf-canvas-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    background: #e0e0e0;
    -webkit-overflow-scrolling: touch;
    user-select: none;
}

.pdf-canvas {
    display: block;
    margin: 0 auto;
    border: 5px solid #ff9a00;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    background: white;
    cursor: move;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(45, 45, 45, 0.9);
    color: #ff9a00;
    padding: 2rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 1000;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9a00, #ff6f00);
    width: 0%;
    transition: width 0.3s ease;
}

.highlight-circle {
    position: absolute;
    border: 4px solid #00ff00;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    animation: pulse 2s infinite;
}

#highlights {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.highlight-pointer {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid #00ff00;
    pointer-events: none;
    z-index: 11;
    animation: bounce 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.search-stats {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        max-width: none;
        height: 40vh;
        min-height: 300px;
    }

    .right-panel {
        height: 60vh;
        min-height: 400px;
    }

    .viewer-controls {
        padding: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls-left {
        padding: 0.3rem 0.5rem;
        gap: 0.2rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls-right {
        padding: 0.3rem 0.5rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header-right {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }

    .header-right.session-info {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
        max-width: 350px;
        flex-wrap: wrap;
    }

    .pdf-canvas-container {
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .pdf-canvas {
        max-width: 100%;
        height: auto;
        border: 3px solid #ff9a00;
    }

    .result-item {
        padding: 0.8rem;
        margin-bottom: 0.3rem;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .welcome-features {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .welcome-feature {
        min-width: 250px;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .left-panel {
        height: 35vh;
        min-height: 250px;
    }

    .right-panel {
        height: 65vh;
        min-height: 350px;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .credits {
        font-size: 0.7rem;
    }

    .session-info {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
        max-width: 350px;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .logout-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* Mobile-specific optimizations */
.mobile-device .pdf-canvas-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
}

.mobile-device .pdf-canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    max-width: 100%;
    height: auto;
}

.mobile-device .highlight-circle {
    border-width: 3px;
    animation: none; /* Disable animation on mobile for better performance */
}

.mobile-device .highlight-pointer {
    animation: none; /* Disable animation on mobile for better performance */
}

.mobile-device .result-item {
    -webkit-tap-highlight-color: rgba(255, 154, 0, 0.2);
}

.mobile-device .btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-device .form-control {
    -webkit-appearance: none;
    border-radius: 8px;
}

.mobile-device .zoom-slider {
    -webkit-appearance: none;
    background: transparent;
}

.mobile-device .zoom-slider::-webkit-slider-track {
    background: #ddd;
    height: 4px;
    border-radius: 2px;
}

.mobile-device .zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    background: #ff9a00;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
}

/* Prevent text selection on mobile during touch */
.mobile-device .pdf-canvas-container * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Loading indicator for mobile */
.mobile-device .loading {
    font-size: 1rem;
    padding: 1.5rem;
    border-radius: 12px;
}
