/* 
   Main Stylesheet for Blackthorn Crafts
   A navy blue and gold design for handcrafted items website
*/
@font-face {
    font-family: 'Berry Rotunda';
    src: url('Berry Rotunda.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
/* ----- Base Styles ----- */
:root {
    --primary-color: #0a2463;      /* Dark navy blue */
    --secondary-color: #1e3888;    /* Medium navy blue */
    --accent-color: #d4af37;       /* Gold */
    --light-color: #f2f2f2;        /* Light gray */
    --dark-color: #001845;         /* Darkest navy */
    --text-color: #333;
    --light-text: #fff;
    --border-radius: 5px;
    --box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f9f9f9;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Berry Rotunda', 'Playfair Display', Georgia, serif;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

h1 {
    color: var(--accent-color); /* Gold heading for logo text */
}

p {
    margin-bottom: 1rem;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    text-align: center;
}

.btn:hover {
    background-color: var(--accent-color);
    color: var(--dark-color);
}

/* ----- Header ----- */
header {
    background-color: var(--dark-color);
    padding: 0;
    box-shadow: var(--box-shadow);
    border-bottom: 3px solid var(--accent-color);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 5%;
}

.logo-container {
    display: flex;
    align-items: center;
}

.site-logo {
    height: 80px;
    width: auto;
    margin-right: 15px;
}

header h1 {
    margin-bottom: 0;
    color: var(--accent-color); /* Gold logo text */
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header nav ul {
    list-style: none;
    display: flex;
}

header nav ul li {
    margin-right: 1.5rem;
}

header nav ul li:last-child {
    margin-right: 0;
}

header nav a {
    color: var(--light-text);
    font-weight: bold;
    padding: 5px 10px;
    border-radius: var(--border-radius);
}

header nav a:hover, 
header nav a.active {
    background-color: var(--accent-color);
    color: var(--dark-color);
}

/* ----- Main Content ----- */
main {
    padding: 2rem 0;
}

main h2 {
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
    color: var(--primary-color);
}

main h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
}

/* ----- Hero Section ----- */
.hero {
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 4rem 0;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    background-image: linear-gradient(
        to right,
        rgba(10, 36, 99, 0.9),
        rgba(30, 56, 136, 0.7)
    );
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero h2 {
    margin-bottom: 1rem;
    font-size: 2.5rem;
    color: var(--accent-color);
}

.hero p {
    margin-bottom: 2rem;
    font-size: 1.2rem;
    color: var(--light-text);
}

/* ----- Product Grid ----- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.product-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: 1px solid #eee;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--accent-color);
}

.product-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.product-card h3 {
    padding: 1rem 1rem 0.5rem;
    font-size: 1.3rem;
    color: var(--primary-color);
}

.product-card .price {
    padding: 0 1rem;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.product-card .description {
    padding: 0.5rem 1rem;
    color: #666;
}

.product-card .btn {
    margin: 1rem;
    display: block;
}

.view-all {
    text-align: center;
    margin: 2rem 0;
}

.view-all a {
    font-weight: bold;
    color: var(--primary-color);
    position: relative;
}

.view-all a:hover {
    color: var(--accent-color);
}

.view-all a::after {
    content: '→';
    margin-left: 5px;
}

/* ----- Single Product Page ----- */
.product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    padding: 2rem;
}

.product-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.product-info h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.product-info .price {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.product-info .category {
    margin-bottom: 1rem;
    color: #666;
}

.stock-status {
    margin-bottom: 1.5rem;
}

.in-stock {
    color: #28a745;
    font-weight: bold;
}

.out-of-stock {
    color: #dc3545;
    font-weight: bold;
}

.product-description {
    margin: 1.5rem 0;
}

.product-description h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.back-btn {
    display: inline-block;
    margin-top: 1rem;
    margin-left: 1rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* ----- Product Gallery ----- */
.product-gallery {
    display: flex;
    flex-direction: column;
}

.main-image {
    margin-bottom: 1rem;
    cursor: pointer;
}

.main-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.thumbnail-gallery {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.thumbnail.active {
    border-color: var(--accent-color);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid white;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.caption {
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 18px;
}

/* ----- About Section ----- */
.about-section {
    background-color: var(--light-color);
    padding: 3rem;
    border-radius: var(--border-radius);
    margin-top: 2rem;
    border-left: 4px solid var(--accent-color);
}

/* ----- Contact Form ----- */
.contact-form {
    max-width: 700px;
    margin: 0 auto 2rem;
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-color);
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.field-error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 0.3rem;
    display: block;
}

.error-message {
    background-color: #fde2e2;
    border-left: 4px solid #e74c3c;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
}

.success-message {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
}

.contact-info {
    margin-top: 3rem;
    padding: 2rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ----- Error Page ----- */
.error-page {
    text-align: center;
    padding: 3rem 0;
}

.error-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.error-container h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.error-container .btn {
    margin-top: 1.5rem;
}

/* ----- Footer ----- */
footer {
    background-color: var(--dark-color);
    color: var(--light-text);
    padding: 2rem 0;
    text-align: center;
    margin-top: 2rem;
    border-top: 3px solid var(--accent-color);
}

/* ----- Media Queries ----- */
@media (max-width: 768px) {
    .site-header {
        padding: 1rem 3%;
    }
    
    header nav {
        flex-direction: column;
    }
    
    header nav ul {
        margin-top: 1rem;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .about-section {
        padding: 2rem;
    }
    
    .product-details {
        grid-template-columns: 1fr;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 576px) {
    .site-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem 2%;
    }
    
    .logo-container {
        margin-bottom: 1rem;
    }
    
    .site-logo {
        height: 50px;
    }
    
    header nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    header nav ul li {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-form,
    .contact-info {
        padding: 1.5rem;
    }
}

/* Out of Stock Overlay on Product Cards */
.product-card.out-of-stock-card .product-image-wrapper {
    position: relative;
    filter: grayscale(100%);
    opacity: 0.7;
}

.product-card .product-image-wrapper {
    position: relative;
}

.stock-label {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: var(--border-radius);
    font-weight: bold;
    z-index: 2;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    user-select: none;
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

.lightbox-nav:hover {
    color: var(--accent-color);
}

.lightbox-content {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-content.visible {
    opacity: 1;
}

.admin-container {
    max-width: 900px;
    margin: 2rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    background-color: #b33;
    color: white;
}

.admin-welcome {
    margin-top: 1rem;
    font-size: 1.1rem;
}

.admin-tools {
    margin-top: 2rem;
}

.admin-actions {
    margin-top: 0.5rem;
}

.admin-actions .btn {
    margin-right: 0.5rem;
}

.admin-form .checkbox-group label {
    margin-right: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.2;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn-danger {
    background-color: #b52b27;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.btn-danger:hover {
    background-color: #9f1f1c;
}
