/* Base body and html setup for mobile */
html {
    height: 100%;
    height: -webkit-fill-available;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Mobile touch optimization */
* {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #007acc;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f5f5;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 4px;
    --transition: all 0.3s ease;
    --focus-outline: 3px solid var(--accent-color);
    --focus-offset: 2px;
    --min-touch-target: 44px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Enhanced skip links */
.skip-links {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10001;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    font-size: 14px;
    transition: top 0.3s ease;
    min-height: var(--min-touch-target);
    display: flex;
    align-items: center;
}

.skip-link:focus {
    top: 0;
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}

/* Header styles */
.header {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    flex-shrink: 0;
    gap: 16px;
    min-height: 60px;
}

.header h1 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#user-info {
    font-size: 0.9rem;
    font-weight: 500;
}

.help-btn {
    padding: 10px 16px;
    background: var(--secondary-color);
    color: white;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    min-height: var(--min-touch-target);
    min-width: var(--min-touch-target);
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-btn:hover,
.help-btn:focus {
    background: #2c3e50;
    border-color: var(--accent-color);
    outline: none;
    transform: translateY(-1px);
}

.help-btn:active {
    transform: translateY(0);
}

/* Main content area */
.main-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: calc(100vh - 60px);
    height: calc(-webkit-fill-available - 60px);
    position: relative;
}

/* Enhanced sidebar navigation */
.sidebar {
    width: 340px;
    background: white;
    border-right: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .tab-buttons,
.sidebar.collapsed .sidebar-content {
    display: none !important;
}

.sidebar-header {
    padding: 16px 20px 16px 16px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.sidebar.collapsed .sidebar-header {
    padding: 16px 10px;
    justify-content: center;
    border-bottom: none;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-header h2 {
    display: none;
}

.sidebar-toggle-btn {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--text-light);
    padding: 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus {
    background: #e9ecef;
    border-color: var(--accent-color);
    color: var(--text-color);
    outline: var(--focus-outline);
    outline-offset: 1px;
    transform: scale(1.05);
}

.sidebar.collapsed .sidebar-toggle-btn {
    font-size: 1rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Enhanced tab navigation */
.tab-buttons {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-light);
}

.tab-button {
    padding: 14px 8px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    transition: var(--transition);
    min-height: var(--min-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
}

.tab-button:hover,
.tab-button:focus {
    background: rgba(0,0,0,0.05);
    outline: var(--focus-outline);
    outline-offset: -2px;
}

.tab-button.active {
    background: white;
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 700;
}

.tab-button:focus {
    outline: var(--focus-outline);
    outline-offset: -2px;
    z-index: 1;
}

/* Enhanced tab content */
.tab-content {
    display: none;
    padding: 20px;
    height: calc(100% - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.tab-content.active {
    display: block;
}

.tab-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 8px;
}

.tab-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Enhanced main viewer area */
.viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    overflow: auto;
    min-width: 0;
}

.viewer-header {
    background: white;
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 70px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.zoom-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 8px;
}

.zoom-display {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 50px;
    text-align: center;
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.book-info {
    font-weight: 600;
    color: var(--primary-color);
    max-width: 300px;
    text-align: right;
}

.page-display {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow: auto;
    background: #e8e8e8;
    position: relative;
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.page-display:focus {
    box-shadow: inset 0 0 0 4px var(--accent-color);
}

.page-display:focus-visible {
    outline: var(--focus-outline);
    outline-offset: -4px;
}

.page-container {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: visible;
    transition: transform 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.page-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    cursor: grab;
    object-fit: contain;
    border-radius: 4px;
}

.page-image:active {
    cursor: grabbing;
}

.nav-controls {
    background: white;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-top: 2px solid var(--border-color);
    flex-wrap: wrap;
    min-height: 80px;
}

/* Enhanced button styles with WCAG compliance */
button {
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    min-height: var(--min-touch-target);
    min-width: var(--min-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

button:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button:focus:not(:disabled) {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
    border-color: var(--accent-color);
    z-index: 1;
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: #005a9e;
    border-color: #005a9e;
}

.btn-primary:focus:not(:disabled) {
    background: #005a9e;
    border-color: #005a9e;
    outline: 3px solid rgba(0, 122, 204, 0.5);
}

.btn-secondary {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    font-weight: 600;
}

.btn-secondary:hover:not(:disabled) {
    background: #218838;
    border-color: #218838;
}

/* Enhanced form elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input, 
.form-group select {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    min-height: var(--min-touch-target);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: var(--focus-outline);
    outline-offset: 1px;
    border-color: var(--accent-color);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--accent-color);
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
    line-height: 1.4;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

fieldset {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Enhanced page input specific styles */
.page-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.page-input-container label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.page-input {
    width: 80px;
    text-align: center;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    min-height: auto;
}

.page-input:focus {
    outline: var(--focus-outline);
    outline-offset: 1px;
    border-color: var(--accent-color);
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
}

/* Enhanced content styles */
.toc-item {
    padding: 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
    margin-bottom: 10px;
    border: 2px solid #eee;
    min-height: var(--min-touch-target);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: white;
}

.toc-item:hover {
    background: #f8f9fa;
    border-color: var(--accent-color);
    transform: translateX(4px);
}

.toc-item:focus {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
    background: #f8f9fa;
    border-left-color: var(--accent-color);
}

.toc-item.active {
    background: #e3f2fd;
    border-left-color: var(--accent-color);
    border-color: var(--accent-color);
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.thumbnail {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    padding: 6px;
    background: white;
    min-height: var(--min-touch-target);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
    border-color: var(--accent-color);
}

.thumbnail:focus {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
    transform: scale(1.05);
    border-color: var(--accent-color);
}

.thumbnail img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 4px;
}

.thumbnail-text {
    font-size: 0.75rem;
    color: var(--text-light);
    padding: 4px;
    font-weight: 500;
}

/* Enhanced status indicators */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-light);
    padding: 40px;
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    color: var(--error-color);
    text-align: center;
    padding: 24px;
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: var(--border-radius);
    margin: 12px;
    line-height: 1.6;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.error-message {
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: var(--border-radius);
    padding: 20px;
    color: #721c24;
    line-height: 1.6;
}

.print-summary {
    background: var(--bg-light);
    padding: 12px;
    border-radius: var(--border-radius);
    margin: 12px 0;
    font-size: 14px;
    border: 2px solid var(--border-color);
    font-weight: 500;
}

/* Enhanced popup styles */
#popup-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    max-width: 95vw;
    width: 500px;
    max-height: 90vh;
    pointer-events: none;
}

#popup-container:not(:empty) {
    pointer-events: auto;
}

.popup {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: left;
    animation: popup-appear 0.2s ease-out;
    max-height: 100%;
    overflow-y: auto;
    position: relative;
    border: 3px solid var(--accent-color);
}

@keyframes popup-appear {
    from { 
        opacity: 0; 
        transform: scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.popup-fixed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
}

.popup h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
    text-align: center;
    font-weight: 700;
}

.popup-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.popup-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.popup-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.popup-buttons button {
    min-width: 120px;
}

/* Enhanced help and shortcuts styling */
.shortcuts-list {
    display: grid;
    gap: 12px;
    margin: 20px 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent-color);
    border: 2px solid var(--border-color);
    min-height: var(--min-touch-target);
}

.shortcut-item kbd {
    background: var(--bg-color);
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    font-weight: bold;
    min-width: 90px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-help {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.gesture-icon {
    font-size: 1.4rem;
    min-width: 50px;
    text-align: center;
}

.accessibility-info {
    margin-top: 28px;
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
    border: 2px solid var(--border-color);
}

.accessibility-info h4 {
    margin-bottom: 16px;
    color: var(--success-color);
    font-weight: 600;
}

.accessibility-info ul {
    margin: 12px 0 0 20px;
}

.accessibility-info li {
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Modal Dialog Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-container {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-light);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    font-size: 1.5rem;
    line-height: 1;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

.modal-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.modal-actions button {
    min-height: var(--min-touch-target);
    min-width: var(--min-touch-target);
    padding: 12px 20px;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.modal-actions .btn-secondary {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

.modal-actions .btn-secondary:hover,
.modal-actions .btn-secondary:focus {
    background: var(--border-color);
    outline: var(--focus-outline);
    outline-offset: 2px;
}

.modal-actions .btn-primary {
    background: var(--accent-color);
    border: 2px solid var(--accent-color);
    color: white;
}

.modal-actions .btn-primary:hover,
.modal-actions .btn-primary:focus {
    background: var(--primary-color);
    border-color: var(--primary-color);
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-color: #000;
        --text-light: #333;
        --border-color: #000;
        --focus-outline: 4px solid #000;
    }
    
    button:focus,
    input:focus,
    select:focus,
    .tab-button:focus,
    .toc-item:focus,
    .thumbnail:focus {
        outline: 4px solid #000;
        outline-offset: 2px;
    }
    
    .popup {
        border: 4px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .spinner {
        animation: none;
        border-top-color: transparent;
        border-right-color: var(--accent-color);
    }
    
    .popup {
        animation: none;
    }
}

/* Enhanced mobile responsiveness */
@media (max-width: 1024px) {
    .sidebar {
        width: 300px;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* Mobile-specific layout - inspired by modern mobile book readers */
@media (max-width: 768px) {
    /* Mobile-first approach with bottom navigation */
    html, body {
        font-size: 15px;
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        background: #f8f9fa;
    }
    
    body {
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    /* Mobile header - minimal and collapsible */
    .header {
        height: 50px !important;
        padding: 8px 16px !important;
        background: linear-gradient(135deg, #2c3e50, #3498db);
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        z-index: 100;
        transition: transform 0.3s ease;
    }
    
    .header.hidden {
        transform: translateY(-100%);
    }
    
    .header h1 {
        font-size: 1.0rem !important;
        margin: 0;
        flex: 1;
        color: white;
        text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }
    
    /* Hide desktop-only header elements */
    .header .help-btn,
    .header .settings-btn {
        display: none !important;
    }
    
    /* Mobile main area - full screen book reading */
    .main-area {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative;
        background: #f8f9fa;
    }
    
    /* Mobile sidebar - bottom sheet style */
    .sidebar {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        height: 60px;
        max-height: 60px;
        background: white;
        border-top: 1px solid #e0e6ed;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
        z-index: 50;
        transition: all 0.3s ease;
        border-radius: 16px 16px 0 0;
    }
    
    .sidebar.expanded {
        height: 50vh !important;
        max-height: 50vh !important;
    }
    
    .sidebar-header {
        display: none; /* Hide traditional sidebar header */
    }
    
    /* Mobile tab buttons - bottom navigation style */
    .tab-buttons {
        display: flex;
        height: 60px;
        padding: 0;
        background: white;
        border-radius: 16px 16px 0 0;
    }
    
    .tab-button {
        flex: 1 !important;
        height: 60px !important;
        border: none;
        background: transparent;
        font-size: 0.7rem !important;
        padding: 8px 4px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: #6c757d;
        transition: all 0.2s ease;
        border-radius: 0;
        position: relative;
    }
    
    .tab-button.active {
        color: #007bff;
        background: rgba(0, 123, 255, 0.1);
    }
    
    .tab-button::before {
        content: '';
        display: block;
        width: 20px;
        height: 20px;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        opacity: 0.7;
    }
    
    .tab-button.active::before {
        opacity: 1;
    }
    
    /* Tab icons using CSS shapes */
    #toc-tab-button::before {
        background: radial-gradient(circle, #007bff 2px, transparent 2px),
                    radial-gradient(circle, #007bff 2px, transparent 2px),
                    radial-gradient(circle, #007bff 2px, transparent 2px);
        background-size: 6px 6px;
        background-position: 2px 4px, 2px 10px, 2px 16px;
    }
    
    #thumbnails-tab-button::before {
        background: linear-gradient(#007bff 2px, transparent 2px),
                    linear-gradient(90deg, #007bff 2px, transparent 2px);
        background-size: 100% 6px, 6px 100%;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    /* Hide print tab completely on mobile */
    #print-tab-button,
    #print-tab {
        display: none !important;
    }
    
    /* Mobile sidebar content - expandable */
    .sidebar-content {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        border-radius: 16px 16px 0 0;
        padding: 16px;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.expanded .sidebar-content {
        transform: translateY(0);
    }
    
    /* Mobile viewer - full screen reading */
    .viewer {
        flex: 1 !important;
        margin-bottom: 60px; /* Space for bottom navigation */
        background: #f8f9fa;
        overflow: hidden !important;
        position: relative;
    }
    
    /* Mobile viewer header - simplified */
    /* Mobile viewer header - minimal and auto-hide */
    .viewer-header {
        position: sticky;
        top: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding: 8px 16px;
        z-index: 10;
        transition: transform 0.3s ease;
    }
    
    .viewer-header.hidden {
        transform: translateY(-100%);
    }
    
    /* Mobile zoom controls - simplified and compact */
    .zoom-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        justify-content: center;
    }
    
    .zoom-controls button {
        font-size: 0.7rem;
        padding: 6px 10px;
        min-height: 36px;
        min-width: 50px;
        border-radius: 18px;
        background: rgba(0, 123, 255, 0.1);
        border: 1px solid rgba(0, 123, 255, 0.2);
        color: #007bff;
    }
    
    .zoom-slider {
        flex: 1;
        max-width: 120px;
        height: 6px;
        border-radius: 3px;
        background: rgba(0, 123, 255, 0.2);
        -webkit-appearance: none;
        appearance: none;
    }
    
    .zoom-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #007bff;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    .zoom-display {
        font-size: 0.7rem;
        color: #6c757d;
        min-width: 35px;
        text-align: center;
    }
    
    /* Mobile navigation controls - floating bottom */
    .nav-controls {
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 8px;
        padding: 8px 16px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 24px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
        z-index: 40;
        opacity: 0;
        transition: all 0.3s ease;
    }
    
    .nav-controls.visible {
        opacity: 1;
    }
    
    .nav-controls button {
        font-size: 0.7rem;
        padding: 8px 12px;
        min-height: 40px;
        border-radius: 20px;
        background: rgba(0, 123, 255, 0.1);
        border: 1px solid rgba(0, 123, 255, 0.2);
        color: #007bff;
        min-width: 60px;
    }
    
    /* Mobile page display - full screen reading */
    .page-display {
        flex: 1 !important;
        padding: 16px !important;
        background: #f8f9fa;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        
        /* Reading optimization */
        line-height: 1.6;
        font-size: 16px;
    }
    
    /* Mobile book content - optimized for reading */
    .page-display img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 0 auto 20px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        background: white;
        padding: 8px;
    }
    
    .book-info {
        text-align: center;
        padding: 40px 20px;
        font-size: 1.0rem;
        background: white;
        border-radius: 12px;
        margin: 20px 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        color: #6c757d;
    }
    
    /* Mobile touch areas for page navigation */
    .page-display::before,
    .page-display::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 80px; /* Above navigation */
        width: 25%;
        z-index: 5;
        cursor: pointer;
    }
    
    .page-display::before {
        left: 0;
    }
    
    .page-display::after {
        right: 0;
    }
    
    /* Mobile TOC and thumbnails - optimized display */
    .tab-content {
        padding: 0;
        height: calc(50vh - 140px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .toc-item {
        padding: 12px 16px;
        margin: 0;
        font-size: 0.9rem;
        border-bottom: 1px solid #f0f0f0;
        min-height: 48px;
        display: flex;
        align-items: center;
        transition: background 0.2s ease;
    }
    
    .toc-item:hover,
    .toc-item:focus {
        background: rgba(0, 123, 255, 0.05);
    }
    
    .thumbnail-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
        padding: 16px;
    }
    
    .thumbnail {
        aspect-ratio: 3/4;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        transition: transform 0.2s ease;
    }
    
    .thumbnail:hover,
    .thumbnail:focus {
        transform: scale(1.05);
    }
    
    .thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    button {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 44px;
        min-width: 44px;
        flex: 1 1 auto;
        max-width: 120px;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }
    
    .thumbnail img {
        height: 70px;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1 0 25%;
        font-size: 0.75rem;
        padding: 10px 6px;
        min-height: var(--min-touch-target);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        min-height: 80px;
    }
    
    .header-controls {
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .help-btn,
    .btn-primary {
        flex: 1;
        min-width: 120px;
    }
    
    /* Mobile popup adjustments */
    #popup-container {
        width: 95vw;
        max-width: 95vw;
        padding: 10px;
    }
    
    .popup {
        padding: 20px;
        margin: 0;
        max-height: 85vh;
    }
    
    .shortcut-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px;
    }
    
    .shortcut-item kbd {
        min-width: auto;
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    /* Ultra-mobile optimization - prioritize book content above all */
    body {
        font-size: 14px;
    }
    
    .header {
        height: 45px !important;
        padding: 6px 10px !important;
    }
    
    .header h1 {
        font-size: 0.9rem !important;
    }
    
    /* Minimize sidebar even more on small screens */
    .sidebar {
        max-height: 150px !important;
        min-height: 100px !important;
    }
    
    .sidebar.collapsed {
        height: 40px !important;
        max-height: 40px !important;
        min-height: 40px !important;
    }
    
    /* Maximize viewer space */
    .viewer {
        height: calc(100vh - 195px) !important;
        min-height: 400px;
    }
    
    .sidebar.collapsed + .viewer {
        height: calc(100vh - 85px) !important;
        min-height: 450px;
    }
    
    /* Ultra-compact tabs */
    .tab-button {
        font-size: 0.65rem !important;
        padding: 4px 6px !important;
        min-height: 36px !important;
    }
    
    /* Minimal zoom controls */
    .zoom-controls {
        flex-direction: row;
        gap: 2px;
        padding: 4px 0;
    }
    
    .zoom-controls button {
        font-size: 0.6rem;
        padding: 3px 6px;
        min-height: 32px;
        min-width: 50px;
    }
    
    .zoom-slider {
        min-width: 80px;
        max-width: 120px;
    }
    
    /* Compact navigation */
    .nav-controls {
        gap: 2px;
        padding: 4px 0;
    }
    
    .nav-controls button {
        font-size: 0.6rem;
        padding: 3px 6px;
        min-height: 32px;
        max-width: 70px;
    }
    
    /* Optimized page input */
    .page-input {
        max-width: 60px;
        font-size: 0.7rem;
        height: 32px;
    }
    
    /* Ultra-compact TOC and thumbnails */
    .tab-content {
        padding: 4px;
        max-height: calc(150px - 70px);
    }
    
    .toc-item {
        padding: 6px 8px;
        font-size: 0.7rem;
        min-height: 36px;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 2px;
    }
    
    .thumbnail {
        height: 40px;
        min-height: 36px;
    }
    
    .thumbnail img {
        height: 32px;
    }
    
    /* Minimal page display padding */
    .page-display {
        padding: 4px;
        min-height: 350px;
    }
    
    .book-info {
        padding: 10px;
        font-size: 0.8rem;
        margin: 5px;
    }
    
    .popup {
        padding: 16px;
        max-height: 80vh;
        margin: 10px;
    }
    
    .popup h3 {
        font-size: 1.2rem;
    }
    
    /* Remove conflicting sidebar/viewer styles */
}

    /* Modal adjustments for mobile */
    .modal-container {
        width: 95vw;
        max-height: 85vh;
        margin: 20px;
    }

    .modal-header {
        padding: 16px 20px 12px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-content {
        padding: 16px 20px;
    }

    .modal-close-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.3rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 16px;
    }

    .modal-actions button {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Mobile-optimized layout classes */
.mobile-layout {
    --mobile-sidebar-height: 200px;
    --mobile-collapsed-height: 50px;
}

.mobile-layout .header {
    height: 50px;
    padding: 8px 12px;
}

.mobile-layout .header h1 {
    font-size: 1.1rem;
    margin: 0;
}

.mobile-optimized {
    border-radius: 0;
    box-shadow: none;
}

.mobile-tabs {
    gap: 4px;
}

.mobile-tabs .tab-button {
    font-size: 0.8rem;
    padding: 8px 12px;
    flex: 1;
    min-height: 44px;
    border-radius: 6px;
}

.mobile-simplified {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.mobile-simplified button {
    font-size: 0.8rem;
    padding: 8px 12px;
    min-height: 44px;
}

.mobile-simplified .zoom-slider {
    width: 100%;
    margin: 8px 0;
}
@media (hover: none) and (pointer: coarse) {
    .toc-item:hover,
    .thumbnail:hover,
    button:hover {
        background: inherit;
        transform: none;
        border-color: inherit;
    }
    
    .toc-item:active {
        background: #f0f0f0;
        transform: scale(0.98);
    }
    
    .thumbnail:active {
        transform: scale(0.95);
    }
    
    button:active {
        transform: scale(0.96);
    }
    
    /* Increase touch targets for better mobile UX */
    .tab-button {
        min-height: 48px;
    }
    
    button {
        min-height: 48px;
        min-width: 48px;
    }
    
    .toc-item,
    .thumbnail {
        min-height: 48px;
    }
}

/* Dark mode support (if system prefers dark) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e0e0e0;
        --text-light: #b0b0b0;
        --bg-color: #1a1a1a;
        --bg-light: #2a2a2a;
        --border-color: #404040;
        --primary-color: #3a4a5a;
        --secondary-color: #4a5a6a;
    }
    
    body {
        background: var(--bg-color);
        color: var(--text-color);
    }
    
    .page-display {
        background: #2a2a2a;
    }
    
    .popup,
    .sidebar,
    .viewer-header,
    .nav-controls {
        background: var(--bg-light);
        color: var(--text-color);
    }
}

/* MOBILE OVERLAY MENU - ADDED FOR MOBILE ONLY - DOES NOT AFFECT DESKTOP */
/* Smooth transitions for layout changes */
.viewer, .page-display {
    transition: all 0.3s ease;
}

/* Ensure desktop styles are reset when not mobile */
@media (min-width: 769px) {
    .mobile-layout .viewer {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        background: transparent !important;
        z-index: auto !important;
    }
    
    .mobile-layout .page-display {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        background: #fff !important;
        z-index: auto !important;
    }
    
    .mobile-overlay {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Full-screen mobile reading mode */
    .mobile-layout .viewer {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: #000 !important;
        z-index: 100 !important;
    }
    
    .mobile-layout .page-display {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: #000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        z-index: 101 !important;
    }
    
    /* Hide default mobile sidebar and navigation that creates the unwanted bottom menu */
    .mobile-layout .sidebar {
        display: none !important;
    }
    
    .mobile-layout .header {
        display: none !important;
    }
    
    .mobile-layout .viewer-header {
        display: none !important;
    }
    
    .mobile-layout .tab-button {
        display: none !important;
    }
    
    .mobile-layout .nav-controls {
        display: none !important;
    }
    
    /* Hide any bottom tabs or navigation elements */
    .mobile-layout .tab-buttons {
        display: none !important;
    }
    
    .mobile-layout .mobile-tabs {
        display: none !important;
    }
    
    /* Ensure no bottom margin that might suggest hidden elements */
    .mobile-layout .main-area {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .mobile-layout .viewer {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .mobile-layout .page-display img {
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }
    
    /* Mobile overlay menu */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(8px);
        z-index: 9999 !important;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-menu {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-radius: 20px 20px 0 0;
        padding: 0;
        max-height: 75vh;
        overflow: hidden;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 10000 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    .mobile-overlay.active .mobile-menu {
        transform: translateY(0);
    }
    
    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 20px 16px;
        border-bottom: 1px solid #f0f0f0;
        background: #f8f9fa;
    }
    
    .mobile-menu-title {
        font-size: 1.2rem;
        font-weight: 600;
        color: #2c3e50;
        margin: 0;
    }
    
    .mobile-menu-close {
        background: #e9ecef;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #6c757d;
        font-size: 1.2rem;
        font-weight: bold;
        transition: all 0.2s ease;
    }
    
    .mobile-menu-close:hover,
    .mobile-menu-close:focus {
        background: #dee2e6;
        color: #495057;
    }
    
    .mobile-menu-tabs {
        display: flex;
        background: #f8f9fa;
        margin: 0;
        padding: 0;
        border-bottom: 1px solid #e9ecef;
    }
    
    .mobile-menu-tab {
        flex: 1;
        background: transparent;
        border: none;
        padding: 16px 12px;
        font-size: 1rem;
        font-weight: 500;
        color: #6c757d;
        cursor: pointer;
        transition: all 0.2s ease;
        border-bottom: 3px solid transparent;
        min-height: 48px;
    }
    
    .mobile-menu-tab.active {
        color: #007bff;
        border-bottom-color: #007bff;
        background: rgba(0, 123, 255, 0.05);
    }
    
    .mobile-menu-content {
        overflow-y: auto;
        max-height: 50vh;
        background: #fff;
    }
    
    /* Mobile TOC display */
    .mobile-toc-list {
        padding: 16px 20px;
    }
    
    .mobile-toc-item {
        display: flex;
        align-items: center;
        padding: 16px;
        border-bottom: 1px solid #f0f0f0;
        cursor: pointer;
        transition: background 0.2s ease;
        border-radius: 8px;
        margin: 4px 0;
    }
    
    .mobile-toc-item:hover,
    .mobile-toc-item:focus {
        background: rgba(0, 123, 255, 0.05);
    }
    
    .mobile-toc-item:last-child {
        border-bottom: none;
    }
    
    .mobile-toc-text {
        flex: 1;
        font-size: 1rem;
        color: #2c3e50;
        line-height: 1.4;
    }
    
    .mobile-toc-page {
        font-size: 0.9rem;
        color: #6c757d;
        margin-left: 12px;
    }
    
    /* Mobile thumbnails display */
    .mobile-thumbnails-header {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 12px 16px 8px;
        border-bottom: 1px solid #f0f0f0;
        background: #f8f9fa;
    }
    
    .mobile-load-more {
        background: #007bff;
        color: white;
        border: none;
        padding: 12px 24px;
        border-radius: 8px;
        font-size: 0.9rem;
        cursor: pointer;
        transition: all 0.2s ease;
        min-height: 44px;
        white-space: nowrap;
        flex-shrink: 0;
        font-weight: 500;
        min-width: 200px;
    }
    
    .mobile-load-more:disabled {
        background: #e9ecef;
        color: #6c757d;
        cursor: not-allowed;
    }
    
    .mobile-load-more:not(:disabled):hover {
        background: #0056b3;
    }
    
    .mobile-thumb-info {
        font-size: 0.85rem;
        color: #6c757d;
        font-weight: 500;
        flex: 1;
    }
    
    .mobile-thumbnails-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 10px;
        padding: 12px 16px;
        max-height: 45vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-thumbnails-footer {
        padding: 12px 16px 20px;
        background: #f8f9fa;
        border-top: 1px solid #f0f0f0;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .mobile-thumbnail {
        aspect-ratio: 3/4;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        cursor: pointer;
        transition: all 0.2s ease;
        position: relative;
        background: #f8f9fa;
    }
    
    .mobile-thumbnail:hover,
    .mobile-thumbnail:focus {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    }
    
    .mobile-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    
    .mobile-thumbnail-number {
        position: absolute;
        bottom: 8px;
        right: 8px;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 0.8rem;
        font-weight: 500;
    }
    
    /* Loading states */
    .mobile-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        color: #6c757d;
        font-size: 1rem;
    }
    
    .mobile-loading::before {
        content: '';
        width: 20px;
        height: 20px;
        border: 2px solid #e9ecef;
        border-top: 2px solid #007bff;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-right: 12px;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}