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

body {
    font-family: 'Mulish', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

header {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
    background: rgba(0, 0, 0, 0.1);
}

header h1 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
        "image-processing slides"
        "summary summary";
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "image-processing"
            "slides"
            "summary";
        padding: 1rem;
    }
}

.image-processing-column {
    grid-area: image-processing;
}

.slides-column {
    grid-area: slides;
}

.summary-section {
    grid-area: summary;
}

.drop-zone {
    background: rgba(255, 255, 255, 0.95);
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #764ba2;
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.drop-content p:first-child {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.drop-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #666;
}

.upload-divider {
    margin: 1.5rem 0;
    position: relative;
    color: #999;
}

.upload-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
    z-index: 1;
}

.upload-divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 1rem;
    position: relative;
    z-index: 2;
    font-size: 0.9rem;
}

.file-upload-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem 0;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.file-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.upload-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.5rem;
}

.image-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.image-display h3 {
    margin-bottom: 1rem;
    color: #333;
}

.image-display img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 0.5rem;
    font-family: 'Mulish', sans-serif;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

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

.loading {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.slides-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2rem;
    height: fit-content;
}

.slide-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.slide-thumbnail {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f8f9fa;
}

.slide-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.slide-thumbnail img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.slide-thumbnail-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.slides-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.summary-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2rem;
}

.summary-section h2 {
    margin-bottom: 1rem;
    color: #333;
    font-family: 'JetBrains Mono', monospace;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-family: 'Mulish', sans-serif;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Tab Content */
.tab-content {
    position: relative;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Grand Summary Controls */
.grand-summary-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.loading-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Suggested Questions */
.suggested-questions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
}

.suggested-questions h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
    cursor: pointer;
}

.question-item:hover {
    background: #e3f2fd;
    border-color: #667eea;
    transform: translateX(4px);
}

.question-text {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.question-context {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.summary-document {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 200px;
    border-left: 4px solid #667eea;
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Markdown styling for summary document */
.summary-document h1,
.summary-document h2,
.summary-document h3,
.summary-document h4 {
    color: #333;
    margin: 1.5rem 0 0.5rem 0;
    font-weight: 600;
}

.summary-document h1 { font-size: 1.5rem; }
.summary-document h2 { font-size: 1.3rem; }
.summary-document h3 { font-size: 1.1rem; }
.summary-document h4 { font-size: 1rem; color: #667eea; }

.summary-document strong {
    font-weight: 600;
    color: #333;
}

.summary-document em {
    font-style: italic;
    color: #555;
}

.summary-document ul,
.summary-document ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.summary-document li {
    margin: 0.5rem 0;
}

.summary-document p {
    margin: 1rem 0;
}

.summary-document code {
    background: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.empty-state {
    color: #666;
    font-style: italic;
    text-align: center;
    margin: 2rem 0;
}

.summary-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    max-width: 500px;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.image-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    margin: 5vh auto;
    padding: 1rem;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #333;
}

#modalImage {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #333;
}

.api-key-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', monospace;
}

.api-key-input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.api-key-note {
    font-size: 0.8rem;
    color: #666;
    margin-top: 1rem;
    font-style: italic;
}

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

.slide-summary {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.slide-summary h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error-message {
    background: #ffe6e6;
    color: #d63384;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    border-left: 4px solid #d63384;
}