/* 
 * Mold Story - Main Stylesheet
 * Custom styles for the Mold Story application
 */

:root {
    --primary-color: #0F4D2E;
    --primary-light: #1A6E43;
    --primary-dark: #0A3A22;
    --secondary-color: #F9ECD5;
    --secondary-light: #FFF8E8;
    --secondary-dark: #E8D9BC;
    --dark-color: #2d3436;
    --light-color: #F9ECD5;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --info-color: #0984e3;
}

/* General Styles */
body {
    font-family: 'Poppins', sans-serif;
    color: #333;
    background-color: var(--light-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

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

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--primary-color);
    color: white;
}

/* Header & Navigation */
.navbar {
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary-color);
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    margin: 0 0.25rem;
}

.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(15, 77, 46, 0.1);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: var(--secondary-light);
    padding: 5rem 0;
    margin-bottom: 3rem;
}

.hero h1 {
    font-weight: 700;
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Book Cards */
.book-card {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

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

.book-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.book-card .card-body {
    padding: 1.5rem;
}

.book-card .card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.book-card .card-text {
    color: #666;
    margin-bottom: 1rem;
}

.book-card .card-footer {
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

.book-card .badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 50rem;
}

/* Featured Section */
.featured-section {
    padding: 4rem 0;
    background-color: var(--secondary-light);
}

.featured-section .section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.featured-section .section-title h2 {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.featured-section .section-title p {
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

/* How It Works Section */
.how-it-works {
    padding: 4rem 0;
}

.how-it-works .step {
    text-align: center;
    padding: 2rem;
}

.how-it-works .step-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--secondary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
}

.how-it-works .step h3 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.how-it-works .step p {
    color: #666;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--secondary-light);
    padding: 4rem 0 2rem;
}

footer h5 {
    font-weight: 600;
    margin-bottom: 1.5rem;
}

footer a {
    color: var(--secondary-light);
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

footer hr {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Forms */
.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.25rem rgba(15, 77, 46, 0.25);
}

.form-label {
    font-weight: 500;
}

/* Navigation & Dropdown Responsive Fixes */
.navbar {
    position: relative;
    z-index: 1030;
}

.navbar-nav .dropdown {
    position: relative;
}

.navbar-nav .dropdown-menu {
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 1031;
    max-width: calc(100vw - 2rem);
}

.navbar-nav .dropdown-item {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-nav .dropdown-item:hover {
    background-color: var(--secondary-light);
    color: var(--primary-color);
}

.navbar-nav .dropdown-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Fix dropdown positioning on desktop */
@media (min-width: 992px) {
    .navbar-nav .dropdown-menu {
        position: absolute;
        right: 0;
        left: auto;
        transform: none;
    }
    
    .navbar-nav .dropdown-menu.dropdown-menu-end {
        right: 0;
        left: auto;
    }
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
    /* Large mobile/tablet dropdown fixes */
    .navbar-nav .dropdown-menu {
        position: static !important;
        transform: none !important;
        box-shadow: none;
        border: 1px solid var(--secondary-dark);
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .navbar-nav .dropdown {
        width: 100%;
    }
    
    .navbar-nav .dropdown-toggle {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 767.98px) {
    .hero {
        padding: 3rem 0;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .featured-section, .how-it-works {
        padding: 3rem 0;
    }
    
    .how-it-works .step {
        margin-bottom: 2rem;
    }
    
    /* Mobile dropdown specific fixes */
    .navbar-nav .dropdown-menu {
        border-radius: 0.25rem;
        margin-top: 0.25rem;
    }
    
    .navbar-nav .dropdown-item {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Ensure dropdown doesn't get cut off */
    .navbar-collapse {
        max-height: none !important;
    }
}

@media (max-width: 575.98px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    /* Small mobile dropdown fixes */
    .navbar-nav .dropdown-menu {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-left: none;
        border-right: none;
        border-radius: 0;
        max-width: calc(100vw - 1rem) !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        transform: none !important;
    }
    
    .navbar-nav .dropdown-item {
        padding: 1.25rem 1rem;
        border-bottom: 1px solid var(--secondary-dark);
        white-space: normal;
        word-wrap: break-word;
    }
    
    .navbar-nav .dropdown-item:last-child {
        border-bottom: none;
    }
    
    /* Make dropdown button more touch-friendly */
    .navbar-nav .dropdown-toggle {
        padding: 0.75rem 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    /* Ensure dropdown container doesn't overflow */
    .navbar-nav .dropdown {
        position: static;
    }
    
    /* Fix for very small screens */
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Additional mobile fixes for all screen sizes */
@media (max-width: 991.98px) {
    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
    }
    
    /* Ensure dropdown is always visible */
    .navbar-nav .dropdown-menu {
        overflow: visible;
        max-height: none;
    }
    
    /* Fix dropdown positioning issues */
    .navbar-nav .dropdown-menu.show {
        display: block !important;
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-top: 0 !important;
        background-color: white !important;
        border: 1px solid var(--secondary-dark) !important;
        border-radius: 0.25rem !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    }
}
