/* Custom CSS for seedtreaty.org */

.text-purple {
    color: #6f42c1 !important;
}

.border-purple {
    border-color: #6f42c1 !important;
}

:root {
    --primary-color: #2c5530;
    --secondary-color: #8FBC8F;
    --accent-color: #DAA520;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --purple-color: #6f42c1;
}

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

/* Language Translation Styles */
#google_translate_element {
    display: none !important;
}

.goog-te-banner-frame {
    display: none !important;
}

.goog-te-menu-value {
    display: none !important;
}

/* Hide Google Translate branding */
.goog-te-gadget {
    display: none !important;
}

.goog-te-combo {
    display: none !important;
}

body {
    top: 0 !important;
}

.language-option.active {
    background-color: var(--primary-color);
    color: white;
}

.language-option:hover {
    background-color: var(--accent-color);
    color: white;
}

#current-language {
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

/* Performance and accessibility optimizations */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Body and Typography */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    margin: 0;
    padding: 0;
    padding-top: 76px; /* Account for fixed navbar */
    /* iOS Safari safe area support */
    padding-top: max(76px, env(safe-area-inset-top));
}

/* Navigation */
.navbar {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1030;
    min-height: 76px;
}

.navbar-scrolled {
    background-color: rgba(44, 85, 48, 0.95) !important;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--accent-color) !important;
}

/* Hero Section */
.hero-section {
    height: 100vh;
    /* iOS Safari viewport fix */
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    display: flex;
    align-items: center;
    color: white;
    overflow: hidden;
    margin-top: -76px; /* Offset the body padding-top */
    margin-top: max(-76px, calc(-1 * env(safe-area-inset-top) - 76px)); /* iOS safe area support */
    padding-top: 76px; /* Add back the space internally */
    padding-top: max(76px, calc(env(safe-area-inset-top) + 76px)); /* iOS safe area support */
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(44, 85, 48, 0.8), rgba(0, 0, 0, 0.6));
    z-index: 2;
}

.hero-section .container {
    position: relative;
    z-index: 3;
}

.hero-section h1 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    animation: fadeInUp 1s ease-out;
}

.hero-section p {
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    animation: fadeInUp 1s ease-out 0.3s both;
}

.hero-section .btn {
    animation: fadeInUp 1s ease-out 0.6s both;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.hero-section .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

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

/* Card Enhancements */
.card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.card-header {
    border-bottom: none;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #1e4023);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800);
    color: #212529;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
}

/* Sections */
section {
    scroll-margin-top: 80px;
}

/* Badge Styling */
.badge {
    border-radius: 20px;
    font-weight: 500;
}

/* Form Styling */
.form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(44, 85, 48, 0.25);
}

/* Alert Styling */
.alert {
    border-radius: 10px;
    border: none;
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    z-index: 1050;
    padding: 0 15px;
}

.flash-messages .alert {
    margin-bottom: 10px;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--dark-color), #2c3e50);
}

footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--accent-color) !important;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        height: 90vh;
        padding: 2rem 0;
    }
    
    .hero-section h1 {
        font-size: 2.5rem !important;
    }
    
    .hero-section .lead {
        font-size: 1.1rem;
    }
    
    .hero-section .btn {
        margin-bottom: 10px;
        width: 100%;
        max-width: 300px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .display-4 {
        font-size: 2rem !important;
    }
    
    .display-5 {
        font-size: 1.5rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .carousel-item blockquote {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Stack chart containers on mobile */
    .chart-container {
        height: 250px;
        margin-bottom: 2rem;
    }
    
    /* Improve petition form on mobile */
    .petition-form {
        padding: 20px;
        margin: 15px 0;
    }
    
    .petition-form .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    /* Better spacing for mobile cards */
    .row.g-4 > * {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        height: 85vh;
        height: 85dvh;
        min-height: 85vh;
        min-height: 85dvh;
        padding: 2rem 0 1.5rem 0;
        /* Ensure content fits within viewport on mobile */
        padding-top: max(2rem, calc(env(safe-area-inset-top) + 1rem + 76px));
    }
    
    .hero-section h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
        margin-bottom: 1rem;
        /* Ensure text is visible and not cut off */
        padding: 0 0.5rem;
    }
    
    .hero-section .lead {
        font-size: 0.95rem;
        line-height: 1.4;
        margin-bottom: 1.5rem;
        /* Better text display on small screens */
        padding: 0 0.5rem;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    /* Improve readability on small screens */
    .small {
        font-size: 0.875rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .petition-form {
        padding: 15px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    /* Make buttons stack vertically on very small screens */
    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .d-flex.gap-2 .btn {
        width: 100%;
    }
}

/* iOS Safari specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (max-width: 576px) {
    /* iPhone specific viewport fixes */
    body {
        /* Prevent iOS Safari from zooming when focusing inputs */
        -webkit-text-size-adjust: 100%;
        /* Better safe area handling */
        padding-top: max(76px, calc(env(safe-area-inset-top) + 76px));
    }
    
    .hero-section {
        /* Use iOS specific viewport units for better mobile Safari support */
        height: calc(100vh - env(safe-area-inset-bottom));
        min-height: calc(100vh - env(safe-area-inset-bottom));
        /* Adjust for iPhone status bar and navigation */
        padding-top: max(100px, calc(env(safe-area-inset-top) + 100px));
    }
    
    .hero-section .container {
        /* Ensure content is properly centered and visible */
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: calc(60vh - env(safe-area-inset-top));
        padding: 1rem 15px;
    }
    
    .hero-section h1 {
        /* iPhone specific text sizing */
        font-size: 1.75rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
        text-align: center;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    .hero-section .lead {
        font-size: 0.9rem;
        line-height: 1.4;
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .navbar {
        /* Better navbar for iOS Safari */
        padding-top: env(safe-area-inset-top);
        min-height: calc(76px + env(safe-area-inset-top));
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Minimum touch target size */
        padding: 12px 16px;
    }
    
    .nav-link {
        padding: 1rem 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .card:hover {
        transform: none; /* Disable hover effects on touch devices */
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Larger touch targets for form elements */
    .form-control {
        min-height: 44px;
        font-size: 16px;
    }
    
    .form-check-input {
        width: 20px;
        height: 20px;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Background Colors */
.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), #1e4023) !important;
}

.bg-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34) !important;
}

.bg-warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800) !important;
}

.bg-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333) !important;
}

.bg-info {
    background: linear-gradient(135deg, var(--info-color), #138496) !important;
}

/* Loading Animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Accessibility */
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    footer,
    .btn,
    .flash-messages {
        display: none !important;
    }
    
    .hero-section {
        height: auto !important;
        color: black !important;
    }
    
    .hero-bg,
    .hero-overlay {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}

/* Custom utilities */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #1e4023);
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
}

.border-radius-lg {
    border-radius: 15px;
}

/* Chart container styling */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Petition form styling */
.petition-form {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
}

.petition-form .form-control {
    background: white;
    border: 2px solid #dee2e6;
}

.petition-form .btn {
    padding: 12px 30px;
    font-size: 1.1rem;
}

/* BBSM Logo responsive sizing */
.bbsm-logo-container {
    margin: 1rem 0;
    overflow: hidden;
}

.bbsm-logo-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Medium screens and up */
@media (min-width: 768px) {
    .bbsm-logo-container img {
        max-width: 280px;
    }
}

/* Small tablets */
@media (max-width: 991px) {
    .bbsm-logo-container img {
        max-width: 240px;
    }
}

/* Mobile devices */
@media (max-width: 767px) {
    .bbsm-logo-container img {
        max-width: 200px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .bbsm-logo-container img {
        max-width: 180px;
    }
}

/* Petition section responsive adjustments */
@media (max-width: 991px) {
    .petition-section .col-lg-6 {
        margin-bottom: 2rem;
    }
    
    .petition-section .row {
        flex-direction: column;
    }
}
