:root {
    --bg: #f5f5fa;
    --surface: #ffffff;
    --accent: #5a67d8;
    --accent-light: rgba(90, 103, 216, 0.1);
    --text: #1f2937;
    --text-light: #4b5563;
    --muted: #9ca3af;
    --success: #059669;
    --warning: #d97706;
    --shadow: 0 14px 30px rgba(31, 41, 55, 0.12);
    --radius: 18px;
    font-size: 16px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.15);
}

.muted {
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 12px 24px rgba(90, 103, 216, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-light {
    background: #fff;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-light.danger {
    border-color: #f87171;
    color: #b91c1c;
}

.btn-block {
    width: 100%;
}

.hero {
    background: linear-gradient(135deg, #4c51bf 0%, #6b46c1 50%, #0c4a6e 100%);
    color: #fff;
    padding: 3rem clamp(1rem, 6vw, 6rem) 5rem;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-size: 1.6rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    font-size: 0.95rem;
}

.nav-links a {
    opacity: 0.9;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.nav-links a:hover,
.nav-links .nav-cta {
    background: rgba(255, 255, 255, 0.18);
}

.cart-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    cursor: pointer;
}

.cart-count {
    background: #fff;
    color: var(--accent);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.hero-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
    align-items: center;
}

.hero h1 {
    font-size: clamp(2.6rem, 5vw, 3.8rem);
    line-height: 1.1;
    margin-bottom: 1.2rem;
}

.hero p {
    opacity: 0.9;
    max-width: 540px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.hero-stats {
    display: grid;
    gap: 1.2rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 600;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

main {
    padding: 4rem clamp(1rem, 6vw, 6rem);
    display: grid;
    gap: 4rem;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.8rem;
}

.section-header h2 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.highlights article {
    max-width: 620px;
}

.highlight-grid {
    margin-top: 2.8rem;
    display: grid;
    gap: 1.6rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.highlight-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.6rem;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.8rem;
}

.highlight-icon {
    font-size: 1.6rem;
    background: var(--accent-light);
    color: var(--accent);
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
}

.category-filters {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    border: 1px solid rgba(90, 103, 216, 0.2);
    background: #fff;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.category-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.book-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.book-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: grid;
}

.book-img {
    height: 220px;
    background: linear-gradient(135deg, rgba(90, 103, 216, 0.12), rgba(90, 103, 216, 0.4));
    background-size: cover;
    background-position: center;
}

.book-info {
    padding: 1.6rem;
    display: grid;
    gap: 0.6rem;
}

.book-category {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--accent);
    text-transform: uppercase;
}

.book-title {
    font-size: 1.15rem;
}

.book-author {
    font-size: 0.9rem;
    color: var(--text-light);
}

.book-pricing {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
}

.book-price {
    font-weight: 600;
    color: var(--accent);
}

.book-mrp {
    text-decoration: line-through;
    color: var(--muted);
    font-size: 0.85rem;
}

.book-discount {
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 500;
}

.book-stock {
    font-size: 0.85rem;
    font-weight: 500;
}

.book-stock.in-stock {
    color: var(--success);
}

.book-stock.low-stock {
    color: var(--warning);
}

.book-stock.out-stock {
    color: var(--muted);
}

.book-card .btn {
    margin-top: 0.6rem;
}

.book-card .btn:disabled {
    background: var(--muted);
    cursor: not-allowed;
    box-shadow: none;
}

.cta {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(2rem, 5vw, 4rem);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    align-items: center;
}

.cta ul {
    margin: 1.4rem 0;
    display: grid;
    gap: 0.6rem;
}

.cta-art {
    font-size: clamp(3rem, 8vw, 6rem);
    text-align: center;
    color: var(--accent);
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: min(420px, 100vw);
    height: 100vh;
    background: #fff;
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    transition: right 0.3s ease;
    z-index: 1001;
}

.cart-drawer.open {
    right: 0;
}

.cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.cart-backdrop.visible {
    opacity: 1;
    pointer-events: all;
}

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

.cart-header button {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    display: grid;
    gap: 1rem;
}

.cart-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.8rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
}

.cart-item h4 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.cart-item .cart-meta {
    display: flex;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-light);
    align-items: center;
}

.quantity-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.quantity-group button {
    background: none;
    border: none;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
}

.quantity-group span {
    padding: 0 0.75rem;
    font-size: 0.9rem;
}

.cart-footer {
    display: grid;
    gap: 1rem;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
}

.footer {
    margin-top: 4rem;
    background: #0f172a;
    color: #e2e8f0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    padding: 3rem clamp(1rem, 6vw, 6rem);
}

.footer h4 {
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.footer ul {
    display: grid;
    gap: 0.4rem;
}

.auth-page {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(2, 132, 199, 0.2));
    display: grid;
    place-items: center;
    padding: 3rem 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: clamp(2rem, 4vw, 3rem);
    width: min(420px, 100%);
    display: grid;
    gap: 1.4rem;
}

.auth-back {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

.auth-subtitle {
    color: var(--text-light);
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-help,
.auth-note {
    font-size: 0.85rem;
    color: var(--text-light);
}

.auth-error {
    color: #dc2626;
    font-size: 0.9rem;
}

.dashboard {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.4rem;
    align-items: center;
}

.dashboard-header h1 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.dashboard-actions {
    display: flex;
    gap: 0.8rem;
}

.dashboard-main {
    display: grid;
    gap: 2rem;
    grid-template-columns: 3fr 2fr;
}

.inventory-panel,
.editor-panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.5rem, 3vw, 2rem);
    display: grid;
    gap: 1.2rem;
}

.inventory-table-wrapper {
    max-height: 60vh;
    overflow: auto;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.inventory-table thead {
    background: rgba(90, 103, 216, 0.08);
}

.inventory-table th,
.inventory-table td {
    padding: 0.8rem;
    text-align: left;
}

.inventory-table tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.08);
}

.inventory-title {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.inventory-title img {
    width: 46px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
}

.inventory-title span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

.editor-form {
    display: grid;
    gap: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-light);
}

.form-feedback {
    font-size: 0.9rem;
    color: var(--success);
    min-height: 1rem;
}

.form-feedback.error {
    color: #dc2626;
}

@media (max-width: 1024px) {
    .dashboard-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .editor-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hero {
        padding-bottom: 3.5rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-drawer {
        padding: 1.6rem;
    }
}
