/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
.main-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    background: linear-gradient(135deg, #1a237e, #283593);
    padding: 12px 0;
}

.header-top .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    color: #fff;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo h1 i {
    margin-right: 8px;
}

.header-right {
    color: #fff;
    font-size: 0.9rem;
}

.date-display i {
    margin-right: 5px;
}

/* ===== NAVIGATION ===== */
.main-nav {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 0;
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-link {
    padding: 8px 15px;
    border-radius: 5px;
    color: #555;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #e8eaf6;
    color: #1a237e;
}

.edition-selector,
.date-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edition-selector label,
.date-picker-wrap label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
}

.edition-selector select,
.date-picker-wrap input {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
}

.edition-selector select:focus,
.date-picker-wrap input:focus {
    outline: none;
    border-color: #1a237e;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 20px 0;
}

/* ===== EPAPER VIEWER ===== */
.epaper-container {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-thumbnails {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.page-thumbnails h3 {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.thumb-item {
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    transition: all 0.3s;
}

.thumb-item:hover,
.thumb-item.active {
    border-color: #1a237e;
    box-shadow: 0 2px 8px rgba(26,35,126,0.2);
}

.thumb-item img {
    width: 100%;
    display: block;
}

.thumb-item .thumb-label {
    text-align: center;
    font-size: 0.75rem;
    padding: 4px;
    background: #f5f5f5;
    color: #555;
}

.thumb-item.active .thumb-label {
    background: #1a237e;
    color: #fff;
}

/* ===== PAGE VIEWER ===== */
.page-viewer {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.viewer-toolbar .page-info {
    font-weight: 600;
    color: #333;
}

.viewer-controls {
    display: flex;
    gap: 8px;
}

.viewer-controls button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.viewer-controls button:hover {
    background: #1a237e;
    color: #fff;
    border-color: #1a237e;
}

.viewer-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.viewer-image-container {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - 250px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #e8e8e8;
    padding: 10px;
}

.viewer-image-container img {
    max-width: 100%;
    height: auto;
    transition: transform 0.3s ease;
    cursor: grab;
}

.viewer-image-container img.zoomed {
    max-width: none;
    cursor: move;
}

/* ===== PAGE NAVIGATION ===== */
.page-nav-arrows {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.page-nav-arrows.left {
    left: 240px;
}

.page-nav-arrows.right {
    right: 20px;
}

.page-nav-arrows button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: rgba(26,35,126,0.8);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-nav-arrows button:hover {
    background: #1a237e;
    transform: scale(1.1);
}

/* ===== HOME PAGE ===== */
.home-hero {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #1a237e, #283593);
    color: #fff;
    border-radius: 10px;
    margin-bottom: 30px;
}

.home-hero h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.home-hero p {
    opacity: 0.8;
    font-size: 1.1rem;
}

.editions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.edition-card {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s;
    cursor: pointer;
    text-align: center;
}

.edition-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.edition-card i {
    font-size: 2.5rem;
    color: #1a237e;
    margin-bottom: 15px;
}

.edition-card h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 8px;
}

.edition-card p {
    color: #777;
    font-size: 0.9rem;
}

/* ===== NO DATA MESSAGE ===== */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.no-data i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ccc;
}

.no-data h3 {
    margin-bottom: 10px;
    color: #555;
}

/* ===== FOOTER ===== */
.main-footer {
    background: #1a237e;
    color: #fff;
    text-align: center;
    padding: 15px 0;
    margin-top: 30px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .epaper-container {
        flex-direction: column;
    }
    
    .page-thumbnails {
        width: 100%;
        max-height: 150px;
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .page-thumbnails h3 {
        display: none;
    }
    
    .thumb-item {
        min-width: 80px;
        margin-bottom: 0;
    }
    
    .page-nav-arrows.left {
        left: 10px;
    }
    
    .header-top .container {
        flex-direction: column;
        gap: 8px;
    }
    
    .main-nav .container {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-left {
        flex-direction: column;
        width: 100%;
    }
    
    .editions-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== ADMIN STYLES ===== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: #1a237e;
    color: #fff;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar .logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.admin-sidebar .logo h2 {
    font-size: 1.3rem;
}

.admin-sidebar .nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    transition: all 0.3s;
    font-size: 0.9rem;
}

.admin-sidebar .nav-menu a:hover,
.admin-sidebar .nav-menu a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.admin-sidebar .nav-menu a i {
    width: 20px;
    text-align: center;
}

.admin-main {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
    background: #f0f2f5;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: #333;
}

/* Admin Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-card i {
    font-size: 2rem;
    color: #1a237e;
    margin-bottom: 10px;
}

.stat-card h3 {
    font-size: 1.8rem;
    color: #333;
}

.stat-card p {
    color: #777;
    font-size: 0.85rem;
}

/* Admin Forms */
.admin-form {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #444;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a237e;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #1a237e;
    color: #fff;
}

.btn-primary:hover {
    background: #283593;
}

.btn-danger {
    background: #c62828;
    color: #fff;
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-success {
    background: #2e7d32;
    color: #fff;
}

.btn-success:hover {
    background: #1b5e20;
}

/* Admin Table */
.admin-table {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a237e, #283593);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #1a237e;
}

.login-box .form-group input {
    padding: 12px 14px;
}

.login-box .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1rem;
}

.alert {
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover {
    border-color: #1a237e;
    background: #f8f9fa;
}

.upload-zone i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 10px;
}

.upload-zone p {
    color: #777;
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.upload-preview .preview-item {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.upload-preview .preview-item img {
    width: 100%;
    display: block;
}

.upload-preview .preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    background: #c62828;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
