/* =========================================================
   DynamicFormsSuite - Global Site Styles (site.css)
   ========================================================= */

/* -----------------------------
   Color palette / CSS variables
   ----------------------------- */
:root {
    --primary-green: #2e7d32;
    --secondary-green: #4caf50;
    --light-green: #8bc34a;
    --dark-green: #1b5e20;
    --earth-brown: #795548;
    --sky-blue: #2196f3;
    --text-dark: #333333;
    --text-light: #666666;
    --background-light: #f9f9f9;
}

/* -----------------------------
   Base global styles
   ----------------------------- */
html,
body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text-dark);
    background-color: var(--background-light);
}

    /* Ensure main content pushes footer down */
    body > .container-fluid,
    body > .container {
        padding-top: 1rem;
    }

/* Links */
a {
    color: var(--primary-green);
    text-decoration: none;
}

    a:hover,
    a:focus {
        color: var(--dark-green);
        text-decoration: underline;
    }

/* -----------------------------
   Navbar / header
   ----------------------------- */
.navbar {
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.15);
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.03em;
}

    .navbar-brand i {
        margin-right: 0.35rem;
    }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

    .nav-link i {
        font-size: 1rem;
    }

/* Active nav item hint */
.navbar-nav .nav-link.active,
.navbar-nav .nav-link.show {
    color: #ffffff;
    background-color: rgba(255,255,255,0.08);
    border-radius: 999px;
}

/* User dropdown menu */
.dropdown-menu {
    border-radius: 0.5rem;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12);
}

/* -----------------------------
   Footer
   ----------------------------- */
.footer {
    background-color: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* -----------------------------
   Cards / panels
   ----------------------------- */
.card {
    border-radius: 0.75rem;
    border: 1px solid rgba(0,0,0,0.05);
}

.card-header {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background-color: #ffffff;
    font-weight: 600;
}

.card.border-0.shadow-sm {
    border-radius: 0.9rem;
}

/* Dashboard-style cards */
.dashboard-card {
    border-top: 4px solid var(--primary-green);
}

/* -----------------------------
   Buttons
   ----------------------------- */
.btn-primary {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: var(--dark-green);
        border-color: var(--dark-green);
    }

.btn-outline-primary {
    color: var(--primary-green);
    border-color: var(--primary-green);
}

    .btn-outline-primary:hover,
    .btn-outline-primary:focus {
        color: #ffffff;
        background-color: var(--primary-green);
    }

.btn-outline-secondary:hover {
    color: #ffffff;
}

/* Small icon buttons */
.btn .bi {
    margin-right: 0.25rem;
}

/* -----------------------------
   Forms & validation
   ----------------------------- */
.form-label {
    font-weight: 500;
}

.form-control,
.form-select {
    border-radius: 0.4rem;
    border-color: rgba(0,0,0,0.15);
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--secondary-green);
        box-shadow: 0 0 0 0.2rem rgba(76,175,80,0.25);
    }

/* Validation summary */
.validation-summary-errors,
.text-danger {
    font-size: 0.9rem;
}

/* Switches */
.form-check-input:checked {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

/* -----------------------------
   Tables (lists, reports, admin)
   ----------------------------- */
.table {
    margin-bottom: 0;
}

    .table thead.table-light th {
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-light);
        background-color: #f4f6f7;
    }

    .table tbody tr:hover {
        background-color: #f5faf5;
    }

    .table td,
    .table th {
        vertical-align: middle;
    }

/* Ensure tables are truly responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Responsive table helpers */
.min-width-200 {
    min-width: 200px;
}

/* -----------------------------
   Status badges
   ----------------------------- */
.badge.bg-success {
    background-color: var(--secondary-green) !important;
}

.badge.bg-secondary {
    background-color: #9e9e9e !important;
}

.badge.bg-warning {
    background-color: #ffb300 !important;
}

/* -----------------------------
   Admin / Field dashboard helpers
   ----------------------------- */
.metric-card {
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    background-color: #ffffff;
    border-left: 4px solid var(--secondary-green);
    box-shadow: 0 0.5rem 1.25rem rgba(0,0,0,0.06);
}

.metric-card-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    margin-bottom: 0.35rem;
}

.metric-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-green);
}

/* Assignment / forms lists */
.status-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    margin-right: 0.35rem;
}

    .status-dot.success {
        background-color: var(--secondary-green);
    }

    .status-dot.warning {
        background-color: #ffb300;
    }

    .status-dot.muted {
        background-color: #bdbdbd;
    }

/* -----------------------------
   Leaflet map containers
   ----------------------------- */
.map-container {
    position: relative;
    width: 100%;
    min-height: 320px;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
}

    .map-container.mini-map {
        min-height: 220px;
    }

    .map-container .leaflet-control {
        font-size: 0.85rem;
    }

.map-legend {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background: rgba(255,255,255,0.9);
    padding: 0.4rem 0.7rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.15);
}

/* -----------------------------
   Loading Animation
   ----------------------------- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-green) 0%, var(--primary-green) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.earth-logo-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
}

.earth-logo-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    z-index: 1;
    position: relative;
}

.earth-rotation {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px dashed rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: rotateEarth 15s linear infinite;
}

.welcome-text {
    margin-bottom: 1rem;
}

.letter-animation {
    animation: bounce 0.8s ease infinite alternate;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0 5px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-subtitle {
    font-size: 1.5rem;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Cursor pointer utility */
.cursor-pointer {
    cursor: pointer;
}

/* Read More/Less links */
.read-more-link:hover,
.read-less-link:hover {
    text-decoration: underline;
    color: var(--primary-green) !important;
}

/* -----------------------------
   Key People - CARD STYLES ONLY
   (no custom grid layout here)
   ----------------------------- */
.key-person-card {
    transition: all 0.3s ease;
    background: white;
    border-radius: 15px;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

    .key-person-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1) !important;
    }

.oval-frame {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--light-green);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
    margin: 0 auto;
}

.default-portrait {
    width: 100%;
    height: 100%;
    background-color: rgba(139, 195, 74, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bio styles */
.brief-bio,
.full-bio {
    color: var(--text-light);
    line-height: 1.6;
    position: relative;
}

.brief-bio {
    font-size: 0.9rem;
    text-align: start;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.full-bio {
    font-size: 0.95rem;
    text-align: start;
    display: none;
}

.read-more-link,
.read-less-link {
    color: var(--primary-green) !important;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: auto;
}

.brief-bio ul,
.brief-bio ol,
.full-bio ul,
.full-bio ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.brief-bio p,
.full-bio p {
    margin-bottom: 1rem;
}

/* Empty State Styles */
.empty-state {
    padding: 4rem 0;
}

.empty-state-icon {
    color: var(--primary-green);
    opacity: 0.5;
}

/* -----------------------------
   Hero Section
   ----------------------------- */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://images.unsplash.com/photo-1542601906990-b4d3fb778b09?ixlib=rb-1.2.1&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 8rem 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

    .hero-section.global {
        background: linear-gradient(rgba(46, 125, 50, 0.9), rgba(76, 175, 80, 0.8)), url('https://images.unsplash.com/photo-1466611653911-95081537e5b7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
        background-size: cover;
        background-position: center;
        min-height: 100vh;
        display: flex;
        align-items: center;
        color: white;
        padding: 100px 0;
    }

    .hero-section .lead {
        font-size: 1.1rem;
        max-width: 32rem;
    }

/* -----------------------------
   Section Titles
   ----------------------------- */
.section-title {
    color: var(--dark-green);
    font-weight: bold;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 1rem;
}

    .section-title::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 60px;
        height: 3px;
        background-color: var(--primary-green);
    }

    .section-title.text-center::after {
        left: 50%;
        transform: translateX(-50%);
    }

/* -----------------------------
   Cards & Stats
   ----------------------------- */
.stats-card,
.expertise-card,
.approach-card,
.mission-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: white;
    border-radius: 15px;
    padding: 2rem;
    height: 100%;
}

    .stats-card:hover,
    .expertise-card:hover,
    .approach-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }

.mission-card {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.05), rgba(76, 175, 80, 0.05));
    border: 2px solid rgba(46, 125, 50, 0.1);
}

/* Stats */
.stats-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-green);
    margin: 1rem 0;
}

.icon-container {
    width: 80px;
    height: 80px;
    background-color: rgba(46, 125, 50, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

    .icon-container i {
        font-size: 2rem;
        color: var(--primary-green);
    }

/* Expertise Cards */
.expertise-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    height: 100%;
    border-left: 4px solid var(--secondary-green);
}

    .expertise-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    }

/* Approach Cards */
.approach-card {
    text-align: center;
    padding: 1.5rem;
    height: 100%;
}

.approach-icon {
    margin-bottom: 1.5rem;
}

/* -----------------------------
   Animations
   ----------------------------- */
@keyframes rotateEarth {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0% {
        transform: translateY(0);
        opacity: 0.5;
    }

    100% {
        transform: translateY(-15px);
        opacity: 1;
    }
}

@keyframes dropIn {
    0% {
        opacity: 0;
        transform: translateY(-100px) rotate(-90deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

/* Stagger the letter animations */
.letter-animation:nth-child(1) {
    animation-delay: 0.1s;
}

.letter-animation:nth-child(2) {
    animation-delay: 0.2s;
}

.letter-animation:nth-child(3) {
    animation-delay: 0.3s;
}

.letter-animation:nth-child(4) {
    animation-delay: 0.4s;
}

.letter-animation:nth-child(5) {
    animation-delay: 0.5s;
}

.letter-animation:nth-child(6) {
    animation-delay: 0.6s;
}

.letter-animation:nth-child(7) {
    animation-delay: 0.7s;
}

.letter-animation:nth-child(8) {
    animation-delay: 0.8s;
}

/* -----------------------------
   Responsive tweaks
   ----------------------------- */
@media (max-width: 992px) {
    .navbar-nav .nav-link {
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
        min-height: auto;
    }

    .letter-animation {
        font-size: 2rem;
    }

    .stats-number {
        font-size: 2.5rem;
    }

    .map-container {
        min-height: 260px;
    }

    /* EARTH home specific mobile adjustments */
    .earth-logo-container {
        width: 120px;
        height: 120px;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
    }

    .mission-content {
        padding: 0 1rem;
    }

    /* Key people mobile adjustments */
    .oval-frame {
        width: 150px;
        height: 150px;
    }

    .brief-bio {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .letter-animation {
        font-size: 1.5rem;
    }

    .hero-section h1 {
        font-size: 1.8rem;
    }

    /* Enhanced mobile table styles */
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }

    /* Mobile button optimizations */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }

    /* Mobile form optimizations */
    .form-control,
    .form-select {
        font-size: 0.9375rem;
    }

    /* Card padding adjustments for mobile */
    .card-body {
        padding: 1rem;
    }

    .stats-card {
        padding: 1.5rem;
    }

    .expertise-card {
        padding: 1.25rem;
    }
}

/* Additional responsive helpers for better mobile experience */
@media (max-width: 480px) {
    /* Hide complex elements on very small screens */
    .d-xxs-none {
        display: none !important;
    }

    /* Adjust font sizes for very small screens */
    h1,
    .h1 {
        font-size: 1.5rem;
    }

    h2,
    .h2 {
        font-size: 1.25rem;
    }

    h3,
    .h3 {
        font-size: 1.1rem;
    }

    /* Compact spacing for mobile */
    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }
}

/* Touch-friendly styles for mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    .btn,
    .form-check-label,
    .nav-link {
        min-height: 44px;
    }

    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
    }

    /* Prevent zoom on form inputs in iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px;
    }

    /* Increase spacing for touch navigation */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }

    .container-fluid {
        padding: 0 !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    .table {
        border: 1px solid #ddd;
    }

        .table th,
        .table td {
            border: 1px solid #ddd;
            padding: 0.5rem;
        }
}
