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

:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --dark-color: #2C3E50;
    --light-color: #ECF0F1;
    --success-color: #2ECC71;
    --danger-color: #E74C3C;
    --text-color: #333;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f8f9fa;
    background: linear-gradient(135deg, color-mix(in hsl,var(--primary-color),hsla(0,0%,100%,.5)), color-mix(in hsl,var(--secondary-color),hsla(0,0%,100%,.5)));
    min-height: 100vh;
}

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

/* Navigation */
.navbar {
    background-color: hsla(0,0%,100%,.4);
    background-size:
        100% 100%,
        100% 100%;
    background-position:
        top 0 left 0,
        top 0 left 0;
    background-repeat:
        no-repeat,
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,100%,.2), hsla(0,0%,0%,.1)),
        linear-gradient(135deg, color-mix(in hsl,var(--primary-color),hsla(0,0%,100%,.3) 60%), color-mix(in hsl,var(--secondary-color),hsla(0,0%,100%,.3) 60%));
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
    margin-bottom:-1.5rem;
    backdrop-filter: blur(6px);
}

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

.nav-brand h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}
.cart-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 500;
}
.btn:not(.btn-icon) {
    background-size:
        100% 100%;
    background-position:
        top 0 left 0;
    background-repeat:
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,100%,.2), hsla(0,0%,0%,.1));
    filter: saturate(80%);
    box-shadow: inset 0 0 1px 1px hsla(0,0%,100%,.4),0 0 1px 1px hsla(0,0%,0%,.25);
}
.btn:not(.btn-icon).btn-block {
    margin: 2px;
    width: -moz-available;
    width: -webkit-fill-available;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-admin {
    background-color: var(--dark-color);
    color: white;
}

.btn-icon {
    background-color: transparent;
    font-size: 1.5rem;
    padding: 0.3rem 0.6rem;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding: 2rem 20px;
}

/* Home Page */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.book-card {
    background-color: hsla(0,0%,100%,.2);
    background-size:
        100% 100%;
    background-position:
        top 0 left 0;
    background-repeat:
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,100%,.7), hsla(0,0%,90%,.5));
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 
        0 0 1px hsla(0,0%,0%,.4),
        var(--box-shadow);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;

}

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

.book-image-container {
    display: flex;
}
.book-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
}

.book-info {
    padding: 1.5rem;
    display: flex;
    flex-grow: 1;
    flex-direction: column;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.book-author {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.book-description {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: auto;
}

.book-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.book-age {
    background-color: var(--accent-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.book-stock {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

/* Contact Page */
.contact-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.contact-info {
    margin-bottom: 2rem;
    text-align: center;
}

.contact-info h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.contact-information p {
    padding-left: 2em;
}
.contact-information {
    margin-top: 2rem;
}
/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    background-color: color-mix(in hsl,#fff,transparent 40%);
    background-size:
        100% 100%;
    background-position:
        top 0 left 0;
    background-repeat:
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,0%,.1), hsla(0,0%,100%,.1));

}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.85rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: hsla(0,0%,100%,.8);
    background-size:
        100% 100%,
        100% 100%;
    background-position:
        top 0 left 0,
        top 0 left 0;
    background-repeat:
        no-repeat,
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,100%,.2), hsla(0,0%,0%,.1)),
        linear-gradient(135deg, color-mix(in hsl,var(--primary-color),hsla(0,0%,100%,.3) 60%), color-mix(in hsl,var(--secondary-color),hsla(0,0%,100%,.3) 60%));
    backdrop-filter: blur(6px);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s;
}

.modal-large {
    max-width: 800px;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.close:hover {
    color: var(--dark-color);
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Cart */
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item-controls button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background-color: var(--secondary-color);
    color: white;
    cursor: pointer;
}

.cart-item-controls button[data-form-role-id="cart-remove-item"] {
    width: auto;
    min-width: 30px;
    border-radius: 15px;
}

.cart-total {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--primary-color);
}

.empty-cart {
    text-align: center;
    padding: 2rem;
    color: #999;
}


.cartNoRegOrderStep {
    display: flex;
    overflow: hidden;
    transition: height 0.3s;
    flex-direction: column;
}
.cartNoRegOrderStep .inline-error {
    display: none;
}
.cartNoRegOrderStep {
    height: 0px;
}
.cartNoRegOrderStep.show {
    height: auto;
}
.cartNoRegOrderStep label{
    display: block;
}
#cartModal .modal-content{
    max-width: max(40vw, 600px);
}

/* Admin Panel */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.book-list-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background-color: hsla(0,0%,100%,.2);
    background-size:
        100% 100%;
    background-position:
        top 0 left 0;
    background-repeat:
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,100%,.7), hsla(0,0%,90%,.5));
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 
        0 0 1px hsla(0,0%,0%,.4),
        var(--box-shadow);
}

.book-list-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.book-list-info {
    flex: 1;
}

.book-list-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Footer */
.footer {
    background-color: color-mix(in hsl,var(--dark-color),transparent 50%);
    background-size:
        100% 100%;
    background-position:
        top 0 left 0;
    background-repeat:
        no-repeat;
    background-image:
        linear-gradient(178deg, hsla(0,0%,100%,.2), hsla(0,0%,0%,.1));
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
    position: fixed;
    bottom: 0;
    width: 100vw;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: white;
        flex-direction: column;
        padding: 2rem;
        transition: left 0.3s;
        box-shadow: var(--box-shadow);
    }

    .nav-menu.active {
        left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .hero h1 {
        font-size: 2rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .cart-item {
        flex-direction: column;
    }

    .book-list-item {
        flex-direction: column;
    }

    .book-list-actions {
        flex-direction: row;
    }
}

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

    .nav-brand h1 {
        font-size: 1.2rem;
    }

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

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }
}
