/* CSS Variables for Consistent Design System */
:root {
    --primary-color: #0A2A66;
    --secondary-color: #1E40AF;
    --accent-color: #3B82F6;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --text-dark: #1F2937;
    --text-light: #6B7280;
    --text-muted: #9CA3AF;
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-white: #FFFFFF;
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
}

/* General page styling */
html {
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-primary);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography Improvements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-dark);
    letter-spacing: -0.025em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.lead {
    font-size: 1.25rem;
    font-weight: 400;
}

/* Navigation Improvements */
.navbar {
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-height: 80px; /* Fixed height to prevent jumping */
    height: 80px; /* Consistent height */
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
    text-decoration: none;
}

.navbar-brand img {
    height: 50px; /* Fixed height instead of width for consistency */
    width: auto;
    object-fit: contain;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--text-dark) !important;
    padding: 0.75rem 1rem !important;
    border-radius: var(--border-radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    height: 48px; /* Fixed height for nav links */
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
    background-color: var(--bg-secondary);
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
    background-color: var(--bg-secondary);
}

/* Fix for navbar button styling */
.navbar-nav .btn {
    font-weight: 500;
    border-radius: var(--border-radius-md);
    padding: 0.5rem 1rem !important;
    margin: 0.25rem 0 0.25rem 0.5rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    border: none;
    transition: all 0.2s ease;
    height: 48px; /* Fixed height for buttons */
}

.navbar-nav .btn-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
    box-shadow: var(--shadow-sm);
}

.navbar-nav .btn-primary:hover {
    background-color: var(--secondary-color) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Ensure consistent navbar container height */
.navbar .container {
    min-height: 80px;
    display: flex;
    align-items: center;
}

/* Fix body layout to prevent jumping */
body {
    padding-top: 0; /* Remove any top padding that might cause jumping */
}

/* Ensure main content starts right after navbar */
main {
    margin-top: 0;
    padding-top: 0;
}

/* Button Improvements */
.btn {
    font-weight: 500;
    letter-spacing: 0.025em;
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    color: var(--text-dark);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Card Improvements */
.card {
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-white);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-color);
}

.card-body {
    padding: 2rem;
}

.card-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 1.5rem 2rem;
    font-weight: 600;
}

/* Alert Improvements */
.alert {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.5rem;
}

.alert-info {
    background-color: #EFF6FF;
    color: #1E40AF;
}

.alert-success {
    background-color: #ECFDF5;
    color: #065F46;
}

.alert-warning {
    background-color: #FFFBEB;
    color: #92400E;
}

.alert-danger {
    background-color: #FEF2F2;
    color: #991B1B;
}

.alert-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-dark);
}

/* Form Improvements */
.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: var(--bg-white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Game-specific styling */
.game-container {
    background: var(--bg-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin: 2rem 0;
}

.field {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-gap: 10px;
    margin: 20px auto;
    width: 330px;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
}

.plot {
    width: 100px;
    height: 100px;
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: var(--bg-white);
    transition: all 0.3s ease;
    border-radius: var(--border-radius-md);
    font-size: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.plot.empty:hover {
    background-color: var(--bg-secondary);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.plot.planted {
    background-color: #DCFCE7;
    border-color: var(--success-color);
}

.plot.ready {
    background-color: #FEF3C7;
    border-color: var(--warning-color);
    animation: pulse 2s infinite;
}

.plot small {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Modal Improvements */
.modal-content {
    border: none;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.5rem 2rem;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1.5rem 2rem;
}

/* Footer Improvements */
.site-footer {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%) !important;
    color: white;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand {
    margin-bottom: 1rem;
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 280px;
}

.footer-title {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.footer-links {
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-block;
}

.footer-link:hover {
    color: white;
    transform: translateX(4px);
}

.social-links {
    margin-top: 1.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.social-link:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 0;
}

.copyright-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.legal-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 0.75rem;
}

.legal-link:last-child {
    border-right: none;
    padding-right: 0;
}

.legal-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

.tagline {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.tagline i {
    color: var(--success-color);
}

/* Responsive footer adjustments */
@media (max-width: 768px) {
    .site-footer .container .row:first-child {
        text-align: center;
    }
    
    .footer-brand {
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .legal-links {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .tagline {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .copyright-text {
        text-align: center;
    }
}

@media (max-width: 576px) {
    .site-footer .py-5 {
        padding: 3rem 0 !important;
    }
    
    .legal-links {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .legal-link {
        border-right: none;
        padding-right: 0;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.shadow-custom {
    box-shadow: var(--shadow-lg);
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(135deg, var(--primary-color), var(--accent-color)) 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .field {
        grid-template-columns: repeat(3, 80px);
        width: 280px;
    }
    
    .plot {
        width: 80px;
        height: 80px;
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    .game-container {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .field {
        grid-template-columns: repeat(3, 70px);
        width: 240px;
        grid-gap: 8px;
    }
    
    .plot {
        width: 70px;
        height: 70px;
        font-size: 1rem;
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus Improvements for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    footer,
    .btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}