/* 
  Project: Model Train Hobbyist
  Theme: Modern, Clean, Hobby-focused
  Colors: Primary, Secondary, Tertiary
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;700;800&display=swap');

:root {
    --primary-color: #0F2C59;
    /* Deep Navy Blue */
    --secondary-color: #D63484;
    /* Vibrant Pink/Magenta Accent - striking */
    /* Alternative Secondary for more classic look: #C51605 (Train Red) - sticking to the request for premium/vibrant */
    /* Let's actually go with a modern "Electric Amber" for secondary to fit "hobbyist" and "premium" */
    --secondary-color-revised: #FF6C22;

    --primary: #1C2B35;
    --secondary: #E85D04;
    --tertiary: #F8F9FA;

    --dark-bg: #121212;
    --dark-card: #1E1E1E;
    --text-main: #333333;
    --text-light: #F8F9FA;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;

    --navbar-height: 80px;
}

[data-theme="dark"] {
    --primary: #A4B5C4;
    /* Lighter version for dark mode contrast */
    --tertiary: #121212;
    --text-main: #E0E0E0;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    background-color: #121212;
    color: #E0E0E0;
}

html {
    height: 100%;
    width: 100%;
}

/* Global Image Responsiveness */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Base Styles */
body {
    font-family: var(--font-body);
    color: var(--text-main);
    background-color: var(--tertiary);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
.text-white h1,
.text-white h2,
.text-white h3,
.text-white h4,
.text-white h5,
.text-white h6,
.bg-dark h1,
.bg-dark h2,
.bg-dark h3,
.bg-dark h4,
.bg-dark h5,
.bg-dark h6,
.bg-primary h1,
.bg-primary h2,
.bg-primary h3,
.bg-primary h4,
.bg-primary h5,
.bg-primary h6,
.bg-secondary h1,
.bg-secondary h2,
.bg-secondary h3,
.bg-secondary h4,
.bg-secondary h5,
.bg-secondary h6 {
    color: #ffffff !important;
}

a {
    text-decoration: none;
    transition: var(--transition);
}

.section-padding {
    padding: 80px 0;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

/* Buttons */
.btn-primary-custom {
    background-color: var(--secondary);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary-custom:hover {
    background-color: #d05304;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(232, 93, 4, 0.3);
    color: #fff;
}

.btn-secondary-custom {
    background-color: #ffffff;
    color: #1c2b35;
    border: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-secondary-custom:hover {
    background-color: #e85d04;
    color: #fff;
    transform: translateY(-2px);
}

.btn-outline-custom {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}

[data-theme="dark"] .btn-outline-custom {
    border-color: #fff;
    color: #fff;
}

.btn-outline-custom:hover {
    background-color: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

[data-theme="dark"] .btn-outline-custom:hover {
    background-color: #fff;
    color: var(--dark-bg);
}

/* Header & Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
    height: var(--navbar-height);
    transition: var(--transition);
}

[data-theme="dark"] .navbar {
    background: rgba(30, 30, 30, 0.9);
}

.navbar-brand {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary) !important;
}

[data-theme="dark"] .navbar-brand {
    color: #fff !important;
}

.nav-link {
    font-weight: 500;
    color: var(--text-main) !important;
    margin: 0 5px;
    position: relative;
}

[data-theme="dark"] .nav-link {
    color: #e0e0e0 !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--secondary);
    transition: width 0.3s;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}


.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

[data-theme="dark"] .navbar-toggler-icon {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.theme-switch {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--primary);
}

[data-theme="dark"] .theme-switch {
    color: #fff;
}

/* Hero Section */
/* Hero Section */
.hero-section {
    background: url('../images/header_bg.png') no-repeat center center/cover;
    position: relative;
    height: 400px;
    /* Fixed height for consistency as requested */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    z-index: 1;
}

/* Overlay for text readability */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 44, 89, 0.7);
    /* Dark Navy Overlay */
    z-index: -1;
}

[data-theme="dark"] .hero-section::before {
    background: rgba(0, 0, 0, 0.85);
    /* Darker overlay in dark mode */
}

/* Home Hero Override - Larger but same style */
.hero-home {
    height: 80vh;
    min-height: 500px;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 800;
    color: #fff !important;
    /* Force white text */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    /* Removed gradient text for better readability on image */
    background: none;
    -webkit-text-fill-color: initial;
}

.hero-subtitle {
    font-size: 1.35rem;
    margin-bottom: 30px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="dark"] .hero-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

/* Cards */
.card-custom {
    border: none;
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-custom .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-custom .btn {
    margin-top: auto;
    align-self: center;
}

[data-theme="dark"] .card-custom {
    background: var(--dark-card);
    border: 1px solid #333;
}

.card-custom:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.card-img-wrapper {
    overflow: hidden;
    height: 200px;
    position: relative;
}

.card-badge-top-right {
    position: absolute;
    top: 0;
    right: 20px;
    z-index: 10;
    padding: 10px 18px !important;
    border-radius: 0 0 10px 10px !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem !important;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.feature-img {
    height: 150px;
    width: 100%;
    object-fit: contain;
    margin-bottom: 20px;
}

.card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-custom:hover .card-img-top {
    transform: scale(1.1);
}

/* Footer */
.footer {
    background-color: var(--primary);
    color: #fff;
    padding: 60px 0 0;
    /* Removing bottom padding completely */
    margin-top: auto;
    margin-bottom: 0 !important;
}

[data-theme="dark"] .footer {
    background-color: #0d1b2a;
}

/* ... (Logo/Links styles unchanged) ... */

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: block;
    color: #fff;
}

.footer h5 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer-links ul {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--secondary);
    padding-left: 5px;
}

.social-icons a {
    color: #fff;
    margin-right: 15px;
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-icons a:hover {
    color: var(--secondary);
    transform: scale(1.2);
}

.copyright {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
    /* Reduced further */
    padding-top: 15px;
    padding-bottom: 20px;
    /* Add explicit bottom padding here instead */
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Back to Top */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 30px;
    background-color: var(--secondary);
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

#back-to-top:hover {
    transform: translateY(-5px);
}

/* Auth Pages Link Hover */
.auth-container a:not(.btn):not(.navbar-brand):hover {
    color: var(--secondary) !important;
    text-decoration: underline !important;
}

/* Utilities */
.text-primary-custom {
    color: var(--primary);
}

.text-secondary-custom {
    color: var(--secondary);
}

.bg-light-custom {
    background-color: #f8f9fa;
}

[data-theme="dark"] .bg-light-custom,
[data-theme="dark"].bg-light-custom {
    background-color: #1a1a1a !important;
}

/* Responsive */
@media (max-width: 991px) {
    .navbar-collapse {
        background: #fff;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        margin-top: 15px;
    }

    /* Fix for mobile buttons spacing */
    .nav-item.ms-lg-3 {
        margin-left: 0 !important;
        margin-top: 15px;
    }

    [data-theme="dark"] .navbar-collapse {
        background: var(--dark-card);
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    .hero-section,
    .hero-home {
        height: auto !important;
        min-height: auto !important;
        padding-top: 80px;
        /* Balanced for mobile */
        padding-bottom: 30px;
        display: block;
        /* Remove flex centering constraint on mobile */
    }

    .hero-title {
        font-size: 1.9rem;
        /* Prevent clipping */
        line-height: 1.3;
        margin-bottom: 15px;
        word-break: break-word;
        white-space: normal;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 25px;
    }

    .hero-content {
        text-align: center;
        margin-bottom: 40px;
    }
}

/* =========================================
   Dark Mode Global Enhancements
   ========================================= */

/* Fix Text Contrast */
[data-theme="dark"] .text-muted {
    color: #b0b0b0 !important;
}

[data-theme="dark"] .text-dark {
    color: #f8f9fa !important;
}

[data-theme="dark"] .text-black-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

[data-theme="dark"] .text-secondary {
    color: #adb5bd !important;
}

/* Forms & Inputs */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #2a2a2a;
    border-color: #444;
    color: #fff;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #333;
    border-color: var(--secondary);
    color: #fff;
}

[data-theme="dark"] .form-control::placeholder {
    color: #888;
}

[data-theme="dark"] .input-group-text {
    background-color: #333;
    border-color: #444;
    color: #e0e0e0;
}

/* Cards & Lists */
[data-theme="dark"] .card {
    background-color: var(--dark-card);
    border-color: #333;
}

[data-theme="dark"] .list-group-item {
    background-color: var(--dark-card);
    color: #e0e0e0;
    border-color: #333;
}

/* Blog Specific Dark Mode */
[data-theme="dark"] .card-blog {
    background: var(--dark-card);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sidebar-card {
    background: var(--dark-card);
}

[data-theme="dark"] .badge.bg-light {
    background-color: #333 !important;
    color: #f8f9fa !important;
    border-color: #555 !important;
}

[data-theme="dark"] .btn-light {
    background-color: #333;
    color: #fff;
    border-color: #444;
}

[data-theme="dark"] .btn-light:hover {
    background-color: #444;
}

/* Specific Fix for Pricing Tables & Blog Cards */
[data-theme="dark"] .card {
    background-color: var(--dark-card) !important;
    border-color: #333 !important;
    color: #e0e0e0;
}

[data-theme="dark"] .btn-outline-dark {
    color: #f8f9fa;
    border-color: #f8f9fa;
}

[data-theme="dark"] .btn-outline-dark:hover,
[data-theme="dark"] .btn-outline-dark.active {
    background-color: #f8f9fa;
    color: #121212;
}

[data-theme="dark"] .card-custom h4.text-muted {
    color: #cccccc !important;
}

[data-theme="dark"] .display-4.fw-bold {
    color: #ffffff;
}

/* Breadcrumb Dark Mode */
[data-theme="dark"] .breadcrumb-item.active {
    color: rgba(255, 255, 255, 0.7) !important;
}

[data-theme="dark"] .breadcrumb-item+.breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.5);
}

/* Responsive Image Utilities */
.responsive-img-height {
    height: 400px;
    width: 100%;
    object-fit: cover;
}

@media (max-width: 576px) {
    .card-img-overlay {
        padding: 1.25rem !important;
    }

    .card-img-overlay h1.display-4,
    .card-img-overlay .display-4 {
        font-size: 1.85rem !important;
        line-height: 1.2;
    }

    .card-img-overlay .lead {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
    }
}

@media (max-width: 768px) {
    .responsive-img-height {
        height: 250px;
    }
}

/* Navbar Enhancements */
.nav-link {
    white-space: nowrap;
}

/* Desktop Navigation Alignment based on User Request - Fixed for 1024px issue */
@media (min-width: 992px) {
    .navbar {
        position: relative;
    }

    .navbar-collapse {
        display: flex !important;
        justify-content: space-between;
        width: 100%;
    }

    .navbar-nav {
        /* Removed absolute positioning to prevent overlap at 1024px */
        margin-left: auto;
        margin-right: auto;
        display: flex;
        align-items: center;
    }

    /* Ensure the right-side buttons stay to the right */
    .navbar-collapse>div:last-child {
        margin-left: 0;
    }
}

/* Specific fix for 992px to 1200px (Medium Desktops like 1024px) */
@media (min-width: 992px) and (max-width: 1200px) {
    .navbar-brand {
        font-size: 1.15rem;
        margin-right: 10px;
    }

    .nav-link {
        font-size: 0.9rem;
        padding-left: 6px !important;
        padding-right: 6px !important;
        margin: 0 2px !important;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}


/* Ensure buttons cluster nicely on mobile */
@media (max-width: 991px) {
    .collapse.navbar-collapse>div {
        justify-content: center;
        width: 100%;
    }
}