/* Smart Reader Section Styles */
.reader-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.reader-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.reader-tabs {
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 15px;
}

.reader-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    transition: 0.3s;
    color: #666;
}

.reader-tab.active {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.reader-content {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    min-height: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* File Grid */
.reader-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.reader-file-card {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    position: relative; /* Fix for absolute children like delete icon */
}

.reader-file-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.reader-file-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

/* Fullscreen Viewer */
.reader-viewer-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh;
    background: #f0f2f5;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    transition: 0.3s ease;
}

.reader-viewer-overlay.maximized {
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
}

.reader-viewer-toolbar {
    background: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.reader-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}

.reader-document-paper {
    background: #fff;
    width: 100%;
    max-width: 850px;
    min-height: 100%;
    padding: 40px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-radius: 4px;
    line-height: 1.8;
}

/* Reading Modes */
.mode-sepia { background: #f4ecd8; color: #5b4636; }
.mode-dark { background: #1a1a1a; color: #e0e0e0; }
.mode-night { background: #0a0a1a; color: #c6d0ff; }

/* Annotation Tools (Floating) */
.reader-tools-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reader-tool-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: 0.2s;
}

.reader-tool-btn:hover {
    transform: scale(1.1);
    background: var(--secondary);
}

/* Chat Interface Styles */
.reader-chat-panel {
    position: fixed;
    top: 60px;
    left: -400px;
    width: 350px;
    height: calc(100vh - 80px);
    background: #fff;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    border-radius: 0 15px 15px 0;
}

.reader-chat-panel.active {
    left: 0;
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fdfdfd;
}

.chat-bubble {
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-bubble.user {
    background: #e1f5fe;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-bubble.ai {
    background: #f1f3f4;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
}

/* Multi-Select Styles */
.reader-select-mode .reader-file-card {
    position: relative;
    border-color: #ddd;
}

.reader-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 5;
}

/* Summary Box */
.ai-summary-box {
    background: linear-gradient(to bottom right, #f0f4ff, #ffffff);
    border-right: 4px solid var(--primary);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    position: relative;
}

/* Flashcards Styles */
.flashcards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
}

.flashcard {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-top: 5px solid var(--primary);
    transition: transform 0.3s;
    cursor: default;
}

.flashcard:hover {
    transform: translateY(-5px);
}

.flashcard-title {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.flashcard-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.spinner-circle {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinCircle 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
}

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