/* ========================================
   AgriLens Base Styles
   Global styles used across all pages
   ======================================== */

/* CSS Custom Properties (Variables) */
:root {
    --primary-green: #22c55e;
    --dark-green: #16a34a;
    --light-green: #dcfce7;
    --accent-green: #4ade80;
    --gradient-start: #22c55e;
    --gradient-end: #16a34a;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --shadow-color: rgba(34, 197, 94, 0.15);
    /* High Contrast Colors for Outdoor/Field Use */
    --forest-green: #166534;
    --deep-green: #15803d;
    --high-contrast-green: #0d4a1f;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body { 
    font-family: 'Poppins', sans-serif; 
    font-size: 0.9375rem;          /* 15px base — readable, not oversized */
    line-height: 1.6;
    color: #374151;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #bbf7d0 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HCI Typography Scale  
   Consistent hierarchy across all pages
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    color: var(--forest-green);
}

h1 { font-size: 2rem;    font-weight: 700; }
h2 { font-size: 1.5rem;  font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.1rem;  font-weight: 600; }
h5 { font-size: 0.95rem; font-weight: 600; }
h6 { font-size: 0.85rem; font-weight: 600; }

p {
    margin-bottom: 0.75rem;
    line-height: 1.65;
}

/* Legal / Policy page typography — smaller, denser text */
.legal-page h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.legal-page h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.legal-page p,
.legal-page li {
    font-size: 0.825rem;
    line-height: 1.7;
    color: #4b5563;
}

.legal-page .lead {
    font-size: 0.9rem;
    font-weight: 400;
}

.legal-page .content-section ul {
    font-size: 0.825rem;
}

/* Small / auxiliary text utility */
.text-xs  { font-size: 0.75rem !important; line-height: 1.5; }
.text-sm  { font-size: 0.8125rem !important; line-height: 1.5; }
.text-base { font-size: 0.9375rem !important; }
.text-lg  { font-size: 1.0625rem !important; }

/* Page header utility — consistent hero headings */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.85;
}

@media (max-width: 768px) {
    body { font-size: 0.875rem; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    .page-title { font-size: 1.6rem; }
    .legal-page h1 { font-size: 1.35rem; }
    .legal-page h4 { font-size: 0.9rem; }
}

/* Animated Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(75, 145, 101, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(74, 222, 128, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(22, 163, 74, 0.05) 0%, transparent 30%);
    pointer-events: none;
    z-index: -1;
}

/* ========================================
   Navigation Styles
   ======================================== */
.navbar {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0;
    box-shadow: 0 2px 20px var(--shadow-color);
    position: relative;
    z-index: 1050;
}

.navbar .container {
    max-width: 1400px;
}

/* Mobile navbar collapse styling */
@media (max-width: 991px) {
    .navbar-collapse {
        background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 1rem;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        z-index: 1050;
    }
    
    .navbar-collapse .navbar-nav {
        gap: 0.3rem;
    }
    
    .navbar-collapse .nav-link {
        padding: 0.5rem 0.75rem !important;
        border-radius: 8px;
        font-size: 0.85rem;
    }
    
    .navbar-collapse .nav-link:hover {
        background: rgba(255,255,255,0.15);
    }
}

@media (min-width: 768px) {
    .navbar {
        padding: 0.5rem 0;
    }
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
}

.navbar-brand:hover {
    transform: scale(1.02);
}

.navbar-brand i {
    animation: leafBounce 2s ease-in-out infinite;
}

@keyframes leafBounce {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.nav-link {
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem !important;
    border-radius: 20px;
    transition: all 0.3s ease;
    margin: 0 0.1rem;
}

@media (min-width: 768px) {
    .nav-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem !important;
        margin: 0 0.15rem;
    }
}

@media (min-width: 1200px) {
    .nav-link {
        font-size: 0.875rem;
        padding: 0.4rem 0.9rem !important;
    }
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ========================================
   Button Styles
   ======================================== */
.btn-agri {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.btn-agri::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn-agri:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-color);
    color: white;
}

.btn-agri:hover::before {
    left: 100%;
}

.btn-agri:active {
    transform: translateY(-1px);
}

/* ========================================
   Card Styles
   ======================================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.4s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Form Styles
   ======================================== */
.form-control, .form-select {
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: #ffffff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
    outline: none;
}

.form-control::file-selector-button {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    margin-right: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-control::file-selector-button:hover {
    background: var(--dark-green);
}

/* ========================================
   Layout Styles
   ======================================== */
.main-content {
    flex: 1;
    padding: 0;
}

.main-content > .container {
    max-width: 100%;
    padding: 0;
}

/* ========================================
   Footer Styles
   ======================================== */
footer {
    background: linear-gradient(135deg, #1f2937, #111827);
    padding: 1.25rem 0;
    margin-top: auto;
}

footer h5 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.9);
}

footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
}

footer a {
    font-size: 0.78rem;
}

footer i {
    color: var(--primary-green);
}

/* ========================================
   Scrollbar Styles
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-green);
}

/* ========================================
   Animations
   ======================================== */
.spinner-grow-sm {
    width: 1rem;
    height: 1rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.15rem;
    }
    
    .btn-agri {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Touch Target Enhancement for Mobile */
@media (max-width: 768px) {
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .btn-agri, 
    .btn-outline-light,
    .btn-light {
        min-height: 44px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-success-soft {
    background: var(--light-green);
    color: var(--dark-green);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 50px;
}

.alert {
    border-radius: 16px;
    border: none;
}

/* ========================================
   Progress Bar
   ======================================== */
.progress {
    background: #e2e8f0;
    border-radius: 50px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 50px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Hero Section
   ======================================== */
.hero-section {
    margin: -1rem -1rem 2rem -1rem;
    padding: 4rem 0;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 2.5rem 0;
        margin: -1rem -1rem 1.5rem -1rem;
    }

    .hero-title {
        font-size: 1.75rem !important;
    }

    .hero-subtitle {
        font-size: 1rem !important;
    }
}

/* ========================================
   Feature Cards
   ======================================== */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(34, 197, 94, 0.2);
}

.feature-card:hover .feature-icon {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.features-section {
    margin: 0 -1rem 2rem -1rem;
    padding: 3rem 1rem !important;
}

@media (max-width: 768px) {
    .features-section {
        margin: 0 -1rem 1.5rem -1rem;
        padding: 2rem 1rem !important;
    }
}

/* ========================================
   Results Page Base Styles
   ======================================== */
.results-page {
    background: #f8fafc;
    min-height: auto;
    padding-top: 20px !important;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 100%;
}

@media (max-width: 1024px) {
    .results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Compact Result Cards */
.result-card, .treatment-card {
    border-radius: 16px;
    padding: 20px;
    background: white;
    border: 1px solid rgba(34, 197, 94, 0.1);
}

@media (max-width: 768px) {
    .result-card, .treatment-card {
        padding: 16px;
    }
}
