/**
 * Custom CSS Overrides & Branding
 * IndobaliExpat Services - Legal & Visa Consultancy
 * 
 * Extends Tailwind CSS with custom animations, brand styles, and edge cases
 */

/* Root Variables for Dynamic Theming */
:root {
    --color-primary: #00354a;
    --color-secondary: #7e5700;
    --color-accent: #25D366;
    --color-success: #4CAF50;
    --color-error: #ba1a1a;
    --color-warning: #FFB74D;
    --color-info: #2196F3;
    
    --font-headline: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: "Noto Serif", Georgia, serif;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 53, 74, 0.12);
    --shadow-xl: 0 20px 40px rgba(0, 53, 74, 0.2);
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for sticky header */
}

/* Remove default button styling */
button {
    border: none;
    font-family: inherit;
    cursor: pointer;
}

/* Link styles */
a {
    color: inherit;
    text-decoration: none;
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Selection Color */
::selection {
    background-color: rgba(0, 53, 74, 0.15);
    color: var(--color-primary);
}

::-moz-selection {
    background-color: rgba(0, 53, 74, 0.15);
    color: var(--color-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background-color: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background-color: var(--color-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-secondary);
}

/* Animations & Transitions */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Slide In from Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

/* Pulse 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;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: none;
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* Glass Morphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.dark .glass-card {
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gradient Text */
.text-gradient {
    background: linear-gradient(135deg, var(--color-primary) 0%, #2c6480 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Gradient Button Hover Effect */
.btn-gradient-hover {
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease;
}

.btn-gradient-hover::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-gradient-hover:hover::before {
    left: 100%;
}

/* Card Hover Shadow Lift */
.card-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-lift:hover {
    box-shadow: 0 12px 32px rgba(0, 53, 74, 0.2);
    transform: translateY(-4px);
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background-color: rgba(0, 53, 74, 0.1);
    color: var(--color-primary);
}

.badge-secondary {
    background-color: rgba(126, 87, 0, 0.1);
    color: var(--color-secondary);
}

.badge-success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--color-success);
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.dark .skeleton {
    background: linear-gradient(
        90deg,
        #3a3a3a 25%,
        #4a4a4a 50%,
        #3a3a3a 75%
    );
    background-size: 200% 100%;
}

/* Responsive Typography Adjustments */
@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem; /* 30px instead of 48px */
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem; /* 24px instead of 32px */
    }
    
    h3 {
        font-size: 1.25rem; /* 20px instead of 24px */
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }
    
    header,
    footer,
    .no-print {
        display: none;
    }
    
    a {
        color: var(--color-primary);
        text-decoration: underline;
    }
}

/* Dark Mode Enhancements */
.dark {
    color-scheme: dark;
}

.dark .text-gradient {
    background: linear-gradient(135deg, #98cded 0%, #c3e8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Utility Classes for Common Patterns */

/* Container Max Width */
.container-max {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Flex Center */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid Auto Fit */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Truncate Text */
.truncate-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.truncate-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.truncate-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Dividers */
.divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-primary),
        transparent
    );
}

/* Responsive Helper Classes */
.hide-on-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-on-mobile {
        display: block;
    }
}

.hide-on-desktop {
    display: block;
}

@media (min-width: 768px) {
    .hide-on-desktop {
        display: none;
    }
}

/* Form Enhancements */
input,
textarea,
select {
    border-radius: 0.5rem;
    border: 1px solid #ccc;
    padding: 0.75rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 53, 74, 0.1);
}

/* Accessibility Improvements */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    body {
        letter-spacing: 0.05em;
    }
    
    a {
        text-decoration: underline;
    }
}