/* bookshop/assets/style.css */

/* Root variables for colours to allow easy customisation */
:root {
    /* Dark themed palette inspired by crca.de style */
    --primary: #0a192f;        /* dark navy background */
    --secondary: #1c3a63;      /* secondary dark blue */
    --accent: #0077b6;         /* accent blue for buttons */
    --light: #112240;          /* card backgrounds */
    --dark: #010c1a;           /* deepest dark */
    --text: #e0e6ed;           /* light text color */
    --muted: #8892b0;          /* muted text */
    --success: #2ca58d;        /* status colors remain */
    --warning: #ffb703;
    --danger: #e63946;
    --border-radius: 6px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--primary);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: #64ffda;
}

a:hover {
    color: #90e0ef;
}

header {
    background-color: var(--dark);
    color: var(--text);
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav li {
    margin-left: 1rem;
}

nav a {
    color: var(--text);
    font-weight: 500;
}

nav a:hover {
    color: #90e0ef;
}

main {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Book grid */
.book-grid {
    /* Use flexbox so that cards wrap and adjust naturally across different screen widths */
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.book-card {
    background-color: var(--light);
    border: 1px solid #1a2f57;
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
    /* Each card will try to take up at least 200px width but can grow to fill available space */
    flex: 1 1 200px;
    max-width: 280px;
    position: relative;
    /* Ensure overflow hidden to keep the discount badge inside */
    overflow: hidden;
    /* Breathing animation applied to each card */
    animation: breathing 6s ease-in-out infinite;
}

/* Discount badge displayed on product tiles */
.discount-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: var(--danger);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 1;
}

/*
 * Highlighted PayPal address on checkout page
 * Adds a light background and accent-coloured text so the email stands out
 */
.paypal-address {
    display: inline-block;
    background-color: var(--light);
    color: var(--accent);
    padding: 0.4rem 0.6rem;
    border-radius: var(--border-radius);
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Keyframes for breathing animation: subtle scaling to mimic a breathing motion */
@keyframes breathing {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.book-card img {
    width: 100%;
    /* Reduce image height for a more compact tile */
    height: 180px;
    object-fit: cover;
    filter: brightness(0.9);
}

.book-card .book-details {
    padding: 0.75rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-details h2 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
    color: #64ffda;
}

.book-details p {
    flex: 1;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.price {
    font-weight: bold;
    color: #e63946;
    margin-bottom: 0.75rem;
}

/* Style for original price when showing discounts */
.price s {
    color: var(--muted);
    margin-right: 0.25rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #0096c7;
}

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

.btn-danger:hover {
    background-color: #a51d33;
}

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

.btn-success:hover {
    background-color: #1f7763;
}

/* Cart table */
table.cart-table {
    width: 100%;
    border-collapse: collapse;
}

table.cart-table th,
table.cart-table td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
    vertical-align: top;
}

table.cart-table th {
    background-color: var(--secondary);
    color: #e0e6ed;
}

/* Forms */
form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

form input[type="text"],
form input[type="email"],
form input[type="number"],
form textarea,
form select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #1a2f57;
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    background-color: var(--dark);
    color: var(--text);
}

form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

form .form-row > div {
    flex: 1 1 200px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.25rem;
    }
    nav ul {
        flex-direction: column;
        width: 100%;
        margin-top: 0.5rem;
    }
    nav li {
        margin-left: 0;
        margin-bottom: 0.5rem;
    }
}