/* About Page Styles - Optimized Vibrant Layouts - FIXED VERSION */

/* Reset and base styles */
:root {
    --primary-dark: #081B31;
    --primary-blue: #0a2a5a;
    --accent-gold: #AA8338;
    --accent-light-gold: #c9a455;
    --animation-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Performance optimizations */
.about-hero-section,
.mission-card,
.vision-card,
.value-circle,
.company-timeline-card,
.region-card {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Hero Section - Updated */
.about-hero-section {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 50%, #f9fafb 100%);
    position: relative;
    overflow: hidden;
    padding-top: 2rem;
    padding-bottom: 2rem;
    display: flex;
    align-items: center;
}

/* Optimize gradient animation - use transform instead of background-position */
.hero-title-gradient {
    background-size: 200% auto;
    animation: gradientFlow 8s ease-in-out infinite;
    display: inline-block;
}

@keyframes gradientFlow {
    0%, 100% { 
        background-position: 0% center; 
    }
    50% { 
        background-position: 100% center; 
    }
}

/* Optimized badge animation */
.hero-badge {
    animation: badgeGlow 3s ease-in-out infinite alternate;
    transition: transform 0.3s var(--animation-timing);
}

.hero-badge:hover {
    transform: translateY(-2px);
}

@keyframes badgeGlow {
    from { 
        box-shadow: 0 0 10px rgba(170, 131, 56, 0.3); 
    }
    to { 
        box-shadow: 0 0 20px rgba(170, 131, 56, 0.6), 0 0 30px rgba(170, 131, 56, 0.3); 
    }
}

/* Optimized floating stats - hardware accelerated */
.floating-stat {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(8, 27, 49, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    animation: floatStat 6s var(--animation-timing) infinite;
    transform: translateZ(0);
    transition: all 0.3s var(--animation-timing);
    min-width: 120px;
}

.floating-stat:hover {
    transform: translateY(-5px) translateZ(0);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

/* Mission & Vision Cards - FIXED: Equal height and same size */
.mission-container, .vision-container {
    height: 100%;
}

.mission-card, .vision-card {
    transition: all 0.5s var(--animation-timing);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.mission-card:hover, .vision-card:hover {
    transform: translateY(-8px) translateZ(0);
}

.mission-card::after, .vision-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.6s var(--animation-timing);
    pointer-events: none;
}

.mission-card:hover::after, .vision-card:hover::after {
    opacity: 1;
}

/* Mission/Vision specific styles */
.mission-pillar, .vision-goal {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    transition: all 0.3s var(--animation-timing);
    cursor: default;
    min-width: 100px;
}

.mission-pillar:hover {
    background: rgba(170, 131, 56, 0.2);
    transform: translateY(-3px);
}

.vision-goal {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    min-width: auto;
}

.vision-goal .h-2 div {
    transition: width 1.5s var(--animation-timing);
    transform: translateZ(0);
}

/* Values Circular Layout - FIXED positioning */
.values-center-circle {
    animation: rotateCenter 30s linear infinite;
}

@keyframes rotateCenter {
    from { 
        transform: translate(-50%, -50%) rotate(0deg); 
    }
    to { 
        transform: translate(-50%, -50%) rotate(360deg); 
    }
}

.value-orbit {
    transition: all 0.8s var(--animation-timing);
    transform: translateZ(0);
}

.value-circle {
    transition: all 0.5s var(--animation-timing);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    width: 100%;
}

.value-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.7s var(--animation-timing);
    pointer-events: none;
}

.value-circle:hover::before {
    left: 100%;
}

.value-circle:hover {
    transform: scale(1.08) translateZ(0);
}

/* Companies Timeline - FIXED ALTERNATING LAYOUT */
.companies-timeline {
    position: relative;
    padding: 2rem 0;
    margin: 0 auto;
}

.timeline-line {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-gold), rgba(170, 131, 56, 0.5), transparent);
    transform: translateX(-50%);
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: linear-gradient(to bottom right, var(--accent-gold), var(--accent-light-gold));
    border: 4px solid var(--primary-dark);
    z-index: 2;
    transition: all 0.3s var(--animation-timing);
}

.timeline-item:hover .timeline-dot {
    transform: translateX(-50%) translateY(-50%) scale(1.2);
    box-shadow: 0 0 0 8px rgba(170, 131, 56, 0.2);
}

.timeline-item {
    position: relative;
    margin-bottom: 4rem;
    min-height: 200px;
}

.company-timeline-card {
    transition: all 0.5s var(--animation-timing);
    transform: translateZ(0);
    position: relative;
}

.company-timeline-card:hover {
    transform: translateY(-5px) translateZ(0);
}

/* Global Presence Map - Updated */
.continent {
    position: absolute;
    background: rgba(170, 131, 56, 0.05);
    border: 2px solid rgba(170, 131, 56, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.continent.africa {
    top: 30%;
    left: 30%;
    width: 200px;
    height: 200px;
}

.continent.europe {
    top: 20%;
    right: 30%;
    width: 100px;
    height: 100px;
}

.continent.middle-east {
    bottom: 30%;
    right: 40%;
    width: 120px;
    height: 120px;
}

.map-grid {
    background-image: 
        linear-gradient(rgba(170, 131, 56, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(170, 131, 56, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
}

.region-card {
    transition: all 0.5s var(--animation-timing);
    transform: translateZ(0);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.region-card:hover {
    transform: translateY(-8px) translateZ(0);
}

/* Optimized particle animations - Now in Companies section */
@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) translateZ(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) translateX(20px) rotate(180deg) translateZ(0);
        opacity: 0;
    }
}

.about-particles-container .particle {
    position: absolute;
    background: linear-gradient(45deg, var(--accent-gold), var(--primary-dark));
    border-radius: 50%;
    animation: particleFloat 10s linear infinite;
    opacity: 0;
    pointer-events: none;
    transform: translateZ(0);
}

/* Fintech Icons Animation */
@keyframes iconFloat {
    0% {
        transform: translateY(100px) translateX(0) rotate(0deg) translateZ(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100px) translateX(20px) rotate(360deg) translateZ(0);
        opacity: 0;
    }
}

.fintech-icons-container .fintech-icon {
    position: absolute;
    font-size: 24px;
    animation: iconFloat 15s linear infinite;
    opacity: 0;
    pointer-events: none;
    transform: translateZ(0);
    color: rgba(170, 131, 56, 0.3);
    text-shadow: 0 0 10px rgba(170, 131, 56, 0.5);
}

.fintech-icons-container .fintech-icon:nth-child(2n) {
    animation-duration: 18s;
    animation-delay: -3s;
    color: rgba(8, 27, 49, 0.3);
}

.fintech-icons-container .fintech-icon:nth-child(3n) {
    animation-duration: 22s;
    animation-delay: -6s;
    color: rgba(255, 255, 255, 0.2);
}

.fintech-icons-container .fintech-icon:nth-child(4n) {
    animation-duration: 25s;
    animation-delay: -9s;
    color: rgba(201, 164, 85, 0.3);
}

/* Loading states */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Responsive Design - Mobile First Approach */
@media (max-width: 640px) {
    .hero-title-gradient {
        font-size: 2.5rem !important;
        line-height: 1.2;
    }
    
    .floating-stat {
        padding: 0.5rem 1rem;
        min-width: 90px;
    }
    
    /* FIX: Mission/Vision cards for mobile */
    .mission-card, .vision-card {
        min-height: 350px;
        padding: 1.5rem !important;
    }
}

/* Mobile Timeline Layout */
@media (max-width: 767px) {
    .timeline-line {
        left: 1.5rem !important;
    }
    
    .timeline-dot {
        left: 1.5rem !important;
        top: 50%;
    }
    
    .timeline-item {
        padding-left: 3rem;
        min-height: auto;
        margin-bottom: 3rem;
    }
    
    .company-timeline-card {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* Reduce animations on mobile for performance */
    .about-particles-container .particle,
    .fintech-icons-container .fintech-icon {
        display: none;
    }
}

/* Desktop Timeline Layout - FIXED ALTERNATING SIDES */
@media (min-width: 768px) {
    .timeline-item {
        min-height: 220px;
        display: flex;
        align-items: center;
    }
    
    .company-timeline-card {
        width: 50%;
    }
    
    /* IMPORTANT: Left side cards (1st, 3rd, 5th, etc.) */
    .timeline-item:nth-of-type(odd) .company-timeline-card {
        margin-right: auto !important;
        margin-left: 0 !important;
        padding-right: 3rem !important;
        padding-left: 0 !important;
    }
    
    /* IMPORTANT: Right side cards (2nd, 4th, 6th, etc.) */
    .timeline-item:nth-of-type(even) .company-timeline-card {
        margin-left: auto !important;
        margin-right: 0 !important;
        padding-left: 3rem !important;
        padding-right: 0 !important;
    }
    
    /* Ensure proper alignment */
    .timeline-item:nth-of-type(odd) {
        justify-content: flex-start;
    }
    
    .timeline-item:nth-of-type(even) {
        justify-content: flex-end;
    }
    
    /* Global presence cards centered vertically */
    .region-card {
        min-height: 300px;
    }
}

@media (min-width: 1024px) {
    /* FIX: Circular layout positioning */
    .value-orbit {
        position: absolute;
    }
    
    /* Proper positioning for desktop circular layout */
    .value-orbit:nth-child(1) { 
        top: 0; 
        left: 50%; 
        transform: translate(-50%, 0); 
    }
    
    .value-orbit:nth-child(2) { 
        top: 50%; 
        right: 0; 
        transform: translate(0, -50%); 
    }
    
    .value-orbit:nth-child(3) { 
        bottom: 0; 
        left: 50%; 
        transform: translate(-50%, 0); 
    }
    
    .value-orbit:nth-child(4) { 
        top: 50%; 
        left: 0; 
        transform: translate(0, -50%); 
    }
    
    .value-circle {
        width: 260px;
    }
    
    /* Ensure region cards are properly centered */
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: center;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .region-card:not(.global-card) {
        background: rgba(255, 255, 255, 0.05) !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        animation-delay: 0ms !important;
    }
    
    .values-center-circle,
    .floating-stat,
    .location-pin,
    .about-particles-container .particle,
    .fintech-icons-container .fintech-icon {
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .mission-card, 
    .vision-card, 
    .value-circle, 
    .company-timeline-card,
    .region-card {
        break-inside: avoid;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
    }
    
    .about-hero-section {
        background: white !important;
        color: black !important;
        min-height: auto;
    }
    
    .hero-title-gradient {
        background: none !important;
        color: black !important;
        -webkit-text-fill-color: black !important;
    }
    
    /* Hide decorative elements */
    .about-particles-container,
    .fintech-icons-container,
    .timeline-line,
    .orbit-lines,
    .continent,
    .map-grid,
    .location-pin,
    .scroll-indicator,
    .hero-badge,
    .floating-stat {
        display: none !important;
    }
}

/* Accessibility improvements */
@media (hover: none) and (pointer: coarse) {
    .value-circle:hover,
    .mission-card:hover,
    .vision-card:hover,
    .company-timeline-card:hover,
    .region-card:hover {
        transform: none;
    }
}

/* Focus styles for accessibility */
a:focus,
button:focus,
.company-timeline-card:focus {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

/* Loading placeholder animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Additional utility classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-loaded {
    opacity: 1 !important;
}

.about-page-loaded {
    opacity: 1;
}

/* Ensure proper stacking */
.relative.z-10 {
    z-index: 10;
}

.absolute.z-10 {
    z-index: 10;
}

/* Fix for hero section overflow */
.overflow-hidden {
    overflow: hidden;
}

/* Ensure text is visible */
.text-transparent {
    -webkit-text-fill-color: transparent;
}

/* Fix for grid layout */
.grid {
    display: grid;
}

/* AOS animation fallback */
[data-aos] {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-aos].aos-animate {
    opacity: 1;
}

/* Custom scrollbar for timeline */
.companies-timeline::-webkit-scrollbar {
    width: 6px;
}

.companies-timeline::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.companies-timeline::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 3px;
}

.companies-timeline::-webkit-scrollbar-thumb:hover {
    background: var(--accent-light-gold);
}

/* Center align region cards content */
.region-card > div {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Mission & Vision - Image & Cards Layout */
.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.mission-card-animated,
.vision-card-animated {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

.mission-card-animated:hover,
.vision-card-animated:hover {
    transform: translateY(-8px) translateZ(0);
}

.progress-animated {
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left;
}

.mission-card-animated:hover .progress-animated,
.vision-card-animated:hover .progress-animated {
    animation: progressPulse 1.5s ease infinite alternate;
}

@keyframes progressPulse {
    from { opacity: 1; }
    to { opacity: 0.8; }
}

/* Card hover effects */
.group:hover .group-hover\:scale-110 {
    transform: scale(1.1);
}

.group:hover .group-hover\:from-\[\\#081B31\]\/5 {
    background-image: linear-gradient(to right, rgba(8, 27, 49, 0.05), white);
}

/* Image container */
.relative.overflow-hidden.rounded-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .lg\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .relative.overflow-hidden.rounded-2xl {
        min-height: 400px;
        margin-bottom: 2rem;
    }
}

@media (max-width: 640px) {
    .relative.overflow-hidden.rounded-2xl {
        min-height: 300px;
    }
    
    .text-2xl.md\:text-3xl {
        font-size: 1.5rem;
    }
    
    .text-lg.md\:text-xl {
        font-size: 1rem;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .animate-gradient,
    .progress-animated,
    .mission-card-animated,
    .vision-card-animated {
        animation: none;
        transition: none;
    }
}