:root {
    --primary-color: #4a90e2;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-radius: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1400px;
    padding: 80px 20px 40px;
    /* Top padding for fixed nav */
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

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

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

.app-title {
    margin: 0;
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
}

.settings-icon {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon:hover {
    background: #f0f7ff;
    transform: rotate(90deg);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header .subtitle {
    font-size: 18px;
    color: #666;
    margin: 0;
}

.config-section,
.upload-section,
.status-section,
#resultSection {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.input-group input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.input-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
}

.mt-10 {
    margin-top: 10px;
}

.file-drop-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px;
    border: 2px dashed #cbd5e0;
    border-radius: var(--border-radius);
    transition: 0.2s;
    cursor: pointer;
}

.file-drop-area:hover {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.file-input {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-msg {
    margin-top: 10px;
    font-weight: 500;
    color: #666;
}

.hidden {
    display: none !important;
}

/* Progress Bar */
.progress-container {
    width: 100%;
}

.progress-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.status-text {
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* Results */
.slides-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.slide-item {
    border-bottom: 1px solid #eee;
    padding-bottom: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.slide-item:last-child {
    border-bottom: none;
}

.slide-image img {
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
}

.slide-note {
    background-color: #fff;
}

.slide-note h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 18px;
}

.slide-note-content {
    line-height: 1.6;
    white-space: pre-wrap;
    color: #444;
}

@media (max-width: 768px) {
    .slide-item {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn-primary,
.btn-success {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
    color: white;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #357abd;
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-cancel {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    color: white;
    background-color: #dc3545;
}

.btn-cancel:hover {
    background-color: #c82333;
}

/* Preview Grid */
.slides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.preview-item img {
    width: 100%;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.preview-page-num {
    text-align: center;
    margin: 5px 0 0;
    font-size: 12px;
    font-weight: bold;
    color: #444;
}

.preview-text {
    font-size: 11px;
    color: #777;
    margin: 4px 0 0;
    padding: 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: 3.2em;
    /* Fallback */
}

/* Table Layout for Preview */
.slides-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.slides-table thead {
    background-color: var(--primary-color);
    color: white;
}

.slides-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.slides-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
}

.slides-table th:nth-child(1),
.slides-table td:nth-child(1) {
    width: 60px;
    text-align: center;
}

.slides-table th:nth-child(2),
.slides-table td:nth-child(2) {
    width: 320px;
    /* Increased from 220px */
}

/* Allow text column to take remaining space */
.slides-table th:nth-child(3),
.slides-table td:nth-child(3) {
    width: auto;
}

.slides-table th:nth-child(4),
.slides-table td:nth-child(4) {
    width: 40%;
}

.slides-table tbody tr:last-child td {
    border-bottom: none;
}

.slides-table tbody tr:hover {
    background-color: #f8f9fa;
}

.slide-num {
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
}

.slide-image-cell img {
    width: 100%;
    max-width: 300px;
    /* Increased from 200px */
    border-radius: 4px;
    border: 1px solid #ddd;
    display: block;
}

.slide-text-cell textarea,
.slide-note-cell textarea {
    width: 100%;
    min-height: 150px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background-color: #f9f9f9;
}

.slide-note-cell textarea.generated-note {
    background-color: #e8f5e9;
    min-height: 200px;
}

.note-placeholder {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 60px 20px;
    background-color: #fafafa;
    border-radius: 4px;
}

@media (max-width: 1200px) {
    .slides-table {
        display: block;
        overflow-x: auto;
    }
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 20px;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Single Slide Generate Button */
.btn-generate-single {
    padding: 6px 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.btn-generate-single:hover {
    background-color: #357abd;
}

.slide-action-cell {
    text-align: center;
}

/* Settings Modal Specific Styles */
.settings-modal-content {
    max-width: 600px;
}

.settings-modal-content .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}