/* ==========================================================================
   INGENIODESK - Custom CSS
   Colors: Primary #3D5A80 | Dark #2C4563 | Light #5B7BA5 | Accent #F59E0B
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BASE / GLOBAL
   -------------------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

::selection {
    background-color: #3D5A80;
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   2. CUSTOM SCROLLBAR
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: #5B7BA5;
    border-radius: 5px;
    border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background: #3D5A80;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #5B7BA5 #f1f5f9;
}

/* --------------------------------------------------------------------------
   3. GRADIENT TEXT UTILITY
   -------------------------------------------------------------------------- */

.gradient-text {
    background: linear-gradient(135deg, #3D5A80 0%, #5B7BA5 50%, #F59E0B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-accent {
    background: linear-gradient(135deg, #F59E0B 0%, #3D5A80 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --------------------------------------------------------------------------
   4. ANIMATIONS
   -------------------------------------------------------------------------- */

/* --- Fade In Up (scroll-triggered) --- */

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

[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* Fallback: if JS hasn't run after 2s, show all elements */
@media (prefers-reduced-motion: reduce) {
    [data-animate] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Safety: ensure elements are visible even if observer fails */
.no-js [data-animate],
[data-animate].force-visible {
    opacity: 1;
    transform: none;
}

/* Staggered delay variants */
[data-animate-delay="100"] { transition-delay: 0.1s; }
[data-animate-delay="200"] { transition-delay: 0.2s; }
[data-animate-delay="300"] { transition-delay: 0.3s; }
[data-animate-delay="400"] { transition-delay: 0.4s; }
[data-animate-delay="500"] { transition-delay: 0.5s; }

/* --- Float Animation (hero cards) --- */

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

.float-animation {
    animation: float 3s ease-in-out infinite;
}

.float-animation-delayed {
    animation: float 3s ease-in-out 1.5s infinite;
}

/* --- Counter Animation Pulse --- */

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

.counter-animate {
    animation: counterPulse 0.3s ease-out;
}

/* --- Spin (loading) --- */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* --- Pulse ring --- */

@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   5. LOADING SPINNER
   -------------------------------------------------------------------------- */

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3D5A80;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-spinner--small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-spinner--accent {
    border-top-color: #F59E0B;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   6. FORM STYLING
   -------------------------------------------------------------------------- */

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1e293b;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #94a3b8;
}

.form-input:hover,
.form-textarea:hover {
    border-color: #5B7BA5;
}

.form-input:focus,
.form-textarea:focus {
    border-color: #3D5A80;
    box-shadow: 0 0 0 3px rgba(61, 90, 128, 0.15);
    background-color: #fafbfc;
}

.form-input:focus.accent-focus,
.form-textarea:focus.accent-focus {
    border-color: #F59E0B;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input.has-error,
.form-textarea.has-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.is-valid,
.form-textarea.is-valid {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2C4563;
}

.form-error-message {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: #ef4444;
}

.form-group {
    margin-bottom: 1.25rem;
}

/* --------------------------------------------------------------------------
   7. MISSION CARD HOVER EFFECTS
   -------------------------------------------------------------------------- */

.mission-card {
    position: relative;
    background: #ffffff;
    border-radius: 1rem;
    padding: 2rem;
    overflow: hidden;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    border: 1px solid #e2e8f0;
}

.mission-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3D5A80, #F59E0B);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.mission-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 10px 25px -5px rgba(61, 90, 128, 0.15),
        0 8px 10px -6px rgba(61, 90, 128, 0.08);
}

.mission-card:hover::before {
    transform: scaleX(1);
}

.mission-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(61, 90, 128, 0.1), rgba(91, 123, 165, 0.1));
    color: #3D5A80;
    margin-bottom: 1.25rem;
    transition: background 0.3s ease, color 0.3s ease;
}

.mission-card:hover .mission-card__icon {
    background: linear-gradient(135deg, #3D5A80, #2C4563);
    color: #ffffff;
}

.mission-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2C4563;
    margin-bottom: 0.5rem;
}

.mission-card__description {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #64748b;
}

/* --------------------------------------------------------------------------
   8. DASHBOARD STYLES
   -------------------------------------------------------------------------- */

/* --- Stat Cards --- */

.stat-card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(61, 90, 128, 0.1);
    transform: translateY(-2px);
}

.stat-card__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #5B7BA5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    color: #2C4563;
    line-height: 1.2;
}

.stat-card__change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.stat-card__change--up {
    color: #22c55e;
}

.stat-card__change--down {
    color: #ef4444;
}

.stat-card--primary {
    border-left: 4px solid #3D5A80;
}

.stat-card--accent {
    border-left: 4px solid #F59E0B;
}

/* --- Progress Bars --- */

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3D5A80, #5B7BA5);
    transition: width 1s ease-out;
    position: relative;
}

.progress-bar__fill--accent {
    background: linear-gradient(90deg, #F59E0B, #fbbf24);
}

.progress-bar__fill--animated {
    background-size: 200% 100%;
    animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-bar--lg {
    height: 12px;
}

.progress-bar--sm {
    height: 4px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    color: #2C4563;
}

.progress-label__percentage {
    font-weight: 700;
    color: #3D5A80;
}

/* --------------------------------------------------------------------------
   9. MOBILE MENU TRANSITIONS
   -------------------------------------------------------------------------- */

#mobile-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}

#mobile-menu.open {
    max-height: 500px;
    opacity: 1;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

#mobile-menu a {
    display: block;
    padding: 0.625rem 0;
    color: #2C4563;
    font-weight: 500;
    border-bottom: 1px solid #e2e8f0;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

#mobile-menu a:last-child {
    border-bottom: none;
}

#mobile-menu a:hover {
    color: #F59E0B;
    padding-left: 0.5rem;
}

/* Toggle button animation */
#mobile-menu-toggle {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#mobile-menu-toggle:active {
    transform: scale(0.9);
}

.menu-open {
    display: block;
}

.menu-close {
    display: none;
}

#mobile-menu-toggle.active .menu-open {
    display: none;
}

#mobile-menu-toggle.active .menu-close {
    display: block;
}

/* --------------------------------------------------------------------------
   10. HEADER SCROLL EFFECT
   -------------------------------------------------------------------------- */

.site-header {
    transition: padding 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.site-header.scrolled {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(61, 90, 128, 0.08);
    background-color: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* --------------------------------------------------------------------------
   11. UTILITY CLASSES
   -------------------------------------------------------------------------- */

.text-primary       { color: #3D5A80; }
.text-primary-dark  { color: #2C4563; }
.text-primary-light { color: #5B7BA5; }
.text-accent        { color: #F59E0B; }

.bg-primary         { background-color: #3D5A80; }
.bg-primary-dark    { background-color: #2C4563; }
.bg-primary-light   { background-color: #5B7BA5; }
.bg-accent          { background-color: #F59E0B; }

.border-primary     { border-color: #3D5A80; }
.border-accent      { border-color: #F59E0B; }

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(61, 90, 128, 0.12);
}

/* --------------------------------------------------------------------------
   12. DASHBOARD TAB SWITCHING
   -------------------------------------------------------------------------- */

/* Hide all panels except the active one */
.dashboard-panel {
    display: none;
}

.dashboard-panel.active,
.dashboard-panel:first-child {
    display: block;
}

/* Dashboard sidebar tab active state */
.dashboard-tab.active {
    border-color: #F59E0B;
    background-color: rgba(245, 158, 11, 0.05);
    color: #2C4563;
}

/* Tab link styled as inline button */
.dashboard-tab-link {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
