/* FlipBook Magazine - Enhanced Edition Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Header */
.header {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.logo-text p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.header-nav {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}

/* Library View */
.library-view {
    padding: 40px 0;
    min-height: calc(100vh - 80px);
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    color: white;
}

.library-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
}

.library-controls {
    display: flex;
    gap: 15px;
}

.search-input,
.sort-select {
    padding: 10px 15px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
    backdrop-filter: blur(10px);
}

.search-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-input {
    width: 250px;
}

/* Magazine Grid */
.magazine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.magazine-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.magazine-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    background: rgba(255,255,255,0.15);
}

.magazine-cover {
    height: 240px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #a0aec0;
    position: relative;
    overflow: hidden;
}

.magazine-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.magazine-info {
    padding: 20px;
    color: white;
}

.magazine-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.magazine-meta {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.magazine-actions {
    display: flex;
    gap: 10px;
}

.magazine-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 8px 12px;
}

/* Empty Library */
.empty-library {
    text-align: center;
    padding: 80px 20px;
    color: white;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 30px;
    opacity: 0.6;
}

.empty-library h3 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.empty-library p {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 30px;
}

/* Reader View */
.reader-view {
    background: #1a1a1a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.reader-header {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.reader-controls-left,
.reader-controls-right {
    display: flex;
    gap: 10px;
}

.reader-title {
    text-align: center;
    color: white;
}

.reader-title h2 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.reader-title p {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Flipbook Container */
.flipbook-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background: radial-gradient(ellipse at center, #2a2a2a 0%, #1a1a1a 100%);
}

.flipbook {
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
}

.flipbook .turn-page {
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.flipbook .turn-page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Reader Footer */
.reader-footer {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-info {
    color: white;
    font-size: 0.95rem;
    min-width: 120px;
    text-align: center;
}

.reader-options {
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-header h3 {
    color: #1a202c;
    font-size: 1.4rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #718096;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f7fafc;
    color: #4a5568;
}

.modal-body {
    padding: 30px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 50px;
    text-align: center;
    background: #f7fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #edf2f7;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: #a0aec0;
    margin-bottom: 20px;
}

.upload-area h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.upload-area p {
    color: #718096;
    margin-bottom: 25px;
}

.upload-info {
    margin-top: 20px;
}

.upload-info small {
    color: #718096;
    font-size: 0.85rem;
}

/* Upload Progress */
.upload-progress {
    text-align: center;
}

.progress-header h4 {
    color: #2d3748;
    margin-bottom: 8px;
}

.progress-header p {
    color: #718096;
    margin-bottom: 25px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 25px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 6px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.step {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
    color: #a0aec0;
    border-radius: 6px;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.step.active {
    background: #edf2f7;
    color: #4a5568;
    font-weight: 600;
}

.step.complete {
    background: #f0fff4;
    color: #22543d;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border-left: 4px solid #48bb78;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-left-color: #e53e3e;
}

.toast.warning {
    border-left-color: #ed8936;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .library-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .library-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .magazine-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .reader-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .reader-controls-left,
    .reader-controls-right {
        justify-content: center;
    }
    
    .reader-footer {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    
    .page-controls {
        justify-content: center;
    }
    
    .reader-options {
        justify-content: center;
    }
    
    .flipbook-container {
        padding: 20px 10px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
}

/* Utility Classes */
.hidden { display: none !important; }
.visible { display: block !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
