/* Admin Panel Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8B1538;
    --secondary-color: #D4AF37;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --border-color: #e1e8ed;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 50px 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.admin-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #D84A6B 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(139, 21, 56, 0.3);
}

.admin-logo i {
    font-size: 40px;
    color: white;
}

.login-header h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.login-form label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

.login-info {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 4px solid var(--primary-color);
}

.login-info i {
    margin-right: 6px;
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #D84A6B 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 21, 56, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 21, 56, 0.4);
}

.btn-login i {
    margin-right: 8px;
}

/* ===== ADMIN DASHBOARD ===== */
.admin-dashboard {
    display: flex;
    height: 100vh;
    background: #f0f2f5;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 20px;
    font-weight: 700;
}

.sidebar-header .logo i {
    font-size: 24px;
    color: var(--secondary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.1);
    color: white;
    border-left-color: var(--secondary-color);
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(231, 76, 60, 0.3);
}

/* Main Content */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-topbar {
    background: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.admin-topbar h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-preview {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #D84A6B 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 21, 56, 0.3);
}

.btn-preview i {
    margin-right: 6px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 500;
}

.admin-user i {
    font-size: 24px;
    color: var(--primary-color);
}

/* ===== CONTENT AREA ===== */
.admin-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.stat-details h3 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-details p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Quick Actions */
.quick-actions {
    background: white;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.quick-actions h2 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-btn {
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Recent Activity */
.recent-activity {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.recent-activity h2 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.no-activity {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    color: var(--text-primary);
}

/* Buttons */
.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #D84A6B 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 21, 56, 0.3);
}

.btn-secondary {
    padding: 10px 20px;
    background: #ecf0f1;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #dfe6e9;
}

/* Data Table */
.table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--dark-bg);
    color: white;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.book-img {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.badge {
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.action-icons {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.icon-btn.edit {
    color: var(--primary-color);
}

.icon-btn.delete {
    color: var(--danger);
}

.icon-btn:hover {
    background: #f0f0f0;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-style: italic;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.book-card img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.book-card-content {
    padding: 16px;
}

.book-card h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.book-card-actions {
    display: flex;
    gap: 8px;
}

.book-card-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-edit-book {
    background: var(--primary-color);
    color: white;
}

.btn-remove-book {
    background: var(--danger);
    color: white;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.setting-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.setting-card h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.setting-card h3 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.setting-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.setting-actions {
    display: flex;
    gap: 12px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 22px;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--danger);
}

.book-form {
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    border-color: var(--primary-color);
    background: rgba(139, 21, 56, 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked+span {
    color: var(--primary-color);
    font-weight: 600;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
}

/* ===== CREDENTIAL VERIFICATION MODAL ===== */
.credential-message {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
    border: 1px solid #4facfe;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.credential-message i {
    font-size: 20px;
}

.error-message {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 1px solid var(--danger);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
    animation: shakeError 0.4s ease;
}

.error-message i {
    font-size: 18px;
}

@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

/* ===== CATEGORIES MANAGEMENT ===== */
.categories-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.category-tab {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-tab:hover {
    border-color: var(--primary-color);
    background: rgba(139, 21, 56, 0.05);
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-tab i {
    font-size: 16px;
}

/* Icon Picker */
.icon-picker {
    position: relative;
}

.icon-picker input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

.btn-icon-picker {
    margin-top: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-picker:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.icon-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
}

.icon-option {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 20px;
    color: var(--text-primary);
}

.icon-option:hover {
    border-color: var(--primary-color);
    background: rgba(139, 21, 56, 0.05);
    transform: scale(1.1);
}

.icon-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* Status Select for Orders */
.status-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.status-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.status-select.status-confirmed {
    background: #e8f5e9;
    border-color: #27ae60;
    color: #27ae60;
}

.status-select.status-processing {
    background: #fff3e0;
    border-color: #f39c12;
    color: #f39c12;
}

.status-select.status-shipped {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #2196f3;
}

.status-select.status-delivered {
    background: #e8f5e9;
    border-color: #27ae60;
    color: #27ae60;
}

.status-select.status-cancelled {
    background: #ffebee;
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Status Badge */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: #e8f5e9;
    color: #27ae60;
}

.status-badge.inactive {
    background: #ffebee;
    color: #e74c3c;
}

/* Responsive Improvements */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
    margin-right: 15px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    /* Layout - Sidebar Drawer */
    .admin-dashboard {
        position: relative;
        overflow-x: hidden;
    }

    .admin-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 260px;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
        transform: translateX(0);
    }

    .admin-sidebar.active {
        transform: translateX(280px);
    }

    /* Topbar */
    .menu-toggle {
        display: block;
    }

    .admin-topbar {
        padding: 15px 20px;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .topbar-left {
        display: flex;
        align-items: center;
    }

    /* Main Content */
    .admin-content {
        padding: 15px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    /* Modals & Forms */
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
        border-radius: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .book-card img {
        height: 240px;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        border-radius: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 15px;
        white-space: nowrap;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .admin-topbar h1 {
        font-size: 18px;
    }

    .topbar-right span {
        display: none;
    }

    .stat-card {
        padding: 15px;
    }

    .login-container {
        padding: 30px 20px;
    }
}