/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
}

.btn-danger {
    background: #dc3545;
}

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

/* Dashboard */
.dashboard {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-top: 20px;
}

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

.header h1 {
    color: #667eea;
    font-size: 32px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #666;
}

/* Navigation */
.nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.nav a {
    padding: 10px 20px;
    background: #f8f9fa;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s;
}

.nav a:hover,
.nav a.active {
    background: #667eea;
    color: white;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.book-cover {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
}

.book-info {
    padding: 15px;
}

.book-info h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 18px;
}

.book-info p {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.book-info .kategori {
    display: inline-block;
    padding: 4px 10px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    color: #667eea;
    margin-top: 10px;
}

/* PDF Reader */
.pdf-reader-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-top: 20px;
}

.pdf-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pdf-controls-left,
.pdf-controls-center,
.pdf-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-controls button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.pdf-controls button:hover {
    background: #5568d3;
}

.pdf-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pdf-controls input[type="number"] {
    width: 60px;
    padding: 6px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
}

#pdf-canvas {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

table th {
    /* background: #667eea; */
    color: white;
    font-weight: 600;
}

table tr:hover {
    background: #f8f9fa;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .pdf-controls {
        flex-direction: column;
        gap: 10px;
    }

    .pdf-controls-left,
    .pdf-controls-center,
    .pdf-controls-right {
        width: 100%;
        justify-content: center;
    }
}

/* Reading Progress */
.reading-progress {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

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

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: #28a745;
}

.notification-error {
    background: #dc3545;
}

.notification-info {
    background: #17a2b8;
}

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

/* Utilities */
.text-center {
    text-align: center;
}

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

.mb-20 {
    margin-bottom: 20px;
}

.d-none {
    display: none;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.2);
}

.status-completed {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.status-not-started {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

/* Form Input Styles */
.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:hover {
    border-color: #ccc;
}

/* Form Row (for side-by-side inputs) */
.form-row {
    display: flex;
    gap: 15px;
}

/* File Upload Styles */
.file-upload-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed #667eea;
    border-radius: 8px;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.file-upload-label:hover {
    background: #f0f2ff;
    border-color: #5568d3;
    transform: translateY(-2px);
}

.file-upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.file-upload-text {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.file-upload-hint {
    font-size: 12px;
    color: #999;
}

.file-name-display {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

/* Form Container */
.form-container {
    width: 100%;
}

/* CRUD Container */
.crud-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.crud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 25px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    flex-wrap: wrap;
    gap: 15px;
}

.crud-header h1 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.crud-header > div {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 15px;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    border: none;
}

table th:first-child {
    border-top-left-radius: 15px;
}

table th:last-child {
    border-top-right-radius: 15px;
}

table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

table tbody tr:hover {
    background: #f8f9ff;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

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

table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 15px;
}

table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 15px;
}

table td {
    padding: 16px 20px;
    text-align: left;
    color: #333;
    font-size: 14px;
    border: none;
    vertical-align: middle;
}

table tbody tr:nth-child(even) {
    background: #fafafa;
}

table tbody tr:nth-child(even):hover {
    background: #f8f9ff;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.filter-section form {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-section .form-group {
    margin-bottom: 0;
}

.filter-section .form-group label {
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.filter-section .form-group input,
.filter-section .form-group select {
    padding: 10px;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .crud-container {
        padding: 20px 15px;
    }

    .table-wrapper {
        margin: 0 -15px;
        border-radius: 0;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .page-header h2 {
        width: 100%;
    }

    .page-header .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .dashboard {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header h1 {
        font-size: 24px;
    }

    .user-info {
        flex-wrap: wrap;
        width: 100%;
    }

    .crud-container {
        padding: 15px 10px;
    }

    .crud-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 20px 15px;
    }

    .crud-header > div {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    .crud-header h1 {
        font-size: 20px;
    }

    .crud-header .btn {
        padding: 10px 18px;
        font-size: 13px;
        flex: 1;
        min-width: 120px;
    }

    .table-wrapper {
        padding: 0;
        margin: 0 -10px;
        border-radius: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: none;
    }

    table {
        font-size: 12px;
        min-width: 800px;
        border-radius: 0;
    }

    table th,
    table td {
        padding: 10px 8px;
        white-space: nowrap;
    }

    table th:first-child,
    table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 5;
    }

    table thead th:first-child {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        z-index: 15;
    }

    .form-container {
        padding: 15px 10px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .book-card {
        margin-bottom: 0;
    }

    .book-cover {
        height: 180px;
    }

    .book-info {
        padding: 12px;
    }

    .book-info h3 {
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card-modern {
        padding: 20px;
    }

    .stat-card-value {
        font-size: 28px;
    }

    .nav {
        flex-wrap: wrap;
    }

    .nav a {
        padding: 8px 15px;
        font-size: 14px;
    }

    .action-buttons {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .filter-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .filter-section form {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .filter-section .form-group {
        width: 100%;
        margin-bottom: 0;
    }

    .filter-section .form-group label {
        margin-bottom: 8px;
    }

    .file-upload-label {
        padding: 30px 15px;
    }

    .file-upload-icon {
        font-size: 36px;
    }

    .filter-section select,
    .filter-section input {
        width: 100%;
    }

    .search-filter-row {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .filter-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn-filter {
        width: 100%;
    }

    .quick-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-tabs {
        flex-direction: column;
        gap: 8px;
    }

    .filter-tab {
        padding: 10px 16px;
        font-size: 14px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .section-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 10px 8px;
    }

    form {
        padding: 15px !important;
    }

    .crud-container {
        padding: 10px 8px;
    }

    .crud-header {
        padding: 15px 12px;
    }

    .crud-header h1 {
        font-size: 18px;
    }

    .crud-header > div .btn {
        flex: 1;
        min-width: 100px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .table-wrapper {
        margin: 0 -8px;
    }

    table {
        font-size: 11px;
        min-width: 700px;
    }

    table th,
    table td {
        padding: 8px 6px;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-sm {
        width: 100%;
        padding: 10px;
    }

    .file-upload-label {
        padding: 20px 10px;
    }

    .file-upload-icon {
        font-size: 32px;
    }

    .file-upload-text {
        font-size: 14px;
    }

    .books-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .book-cover {
        height: 200px;
    }

    .stat-card-modern {
        padding: 15px;
    }

    .stat-card-value {
        font-size: 24px;
    }

    .filter-section {
        padding: 12px;
    }

    .page-header {
        gap: 12px;
    }

    .page-header h2 {
        font-size: 20px;
    }

    .content-area {
        padding: 10px 8px;
    }

    .search-filter-section {
        padding: 15px;
    }
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d91 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
}

/* Alert Styles */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border-left: 5px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-color: #28a745;
}

.alert-success::before {
    content: "✓";
    font-size: 20px;
    font-weight: bold;
    color: #28a745;
}

.alert-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-color: #dc3545;
}

.alert-error::before {
    content: "✗";
    font-size: 20px;
    font-weight: bold;
    color: #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-color: #ffc107;
}

.alert-warning::before {
    content: "⚠";
    font-size: 20px;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-color: #17a2b8;
}

.alert-info::before {
    content: "ℹ";
    font-size: 20px;
    color: #17a2b8;
}
