/* ============================================
   UX IMPROVEMENTS - CUSTOM STYLES
   ============================================ */

/* Skip to main content link */
.skip-to-main-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: #000;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    font-weight: 600;
    border-radius: 0 0 4px 0;
}

.skip-to-main-content:focus {
    top: 0;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus visible styles for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

/* Button hover effects */
.hero-cta-btn,
.premium-contact-btn,
.btn-with-arrow {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-cta-btn:hover,
.premium-contact-btn:hover,
.btn-with-arrow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(253, 215, 9, 0.3);
}

.hero-cta-btn:active,
.premium-contact-btn:active,
.btn-with-arrow:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

/* Form input focus animations */
.premium-contact-form .form-control:focus {
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.premium-contact-form .form-control:not(:placeholder-shown):valid {
    border-color: #28a745;
}

.premium-contact-form .form-control:not(:placeholder-shown):invalid {
    border-color: #dc3545;
}

/* Loading spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.btn-spinner i {
    animation: spin 1s linear infinite;
}

/* Success checkmark animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.form-control.is-valid::after {
    content: '✓';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-weight: bold;
    animation: checkmark 0.3s ease;
}

/* ============================================
   SMOOTH SCROLLING
   ============================================ */

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   SCROLL PROGRESS INDICATOR
   ============================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-color);
    z-index: 10000;
    transition: width 0.1s ease;
}

/* ============================================
   FORM UX IMPROVEMENTS
   ============================================ */

/* Character counter */
#contactMessage-counter {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

#contactMessage-counter.warning {
    color: #ffc107;
}

#contactMessage-counter.danger {
    color: #dc3545;
}

/* Form progress indicator */
.form-progress {
    height: 4px;
    background: rgba(253, 215, 9, 0.2);
    border-radius: 2px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.form-progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Real-time validation feedback */
.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.98-.98-.98-.98-.98.98.98.98zm-.98-3.96L2.3 1.79l.98.98-1.96 1.98zm3.96 0L6.27 1.79l.98.98-1.96 1.98z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

/* Button loading state */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .btn-spinner {
    display: inline-block !important;
}

/* ============================================
   MOBILE UX IMPROVEMENTS
   ============================================ */

/* Safe area support for iOS */
@supports (padding: max(0px)) {
    .hero-buttons-wrapper {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}

/* Touch target sizes */
@media (max-width: 768px) {
    button,
    a.btn,
    .language-selector,
    .hamburguer-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Slide up animation */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-outline {
        border-width: 2px;
    }
    
    .form-control {
        border-width: 2px;
    }
}

/* ============================================
   ERROR HANDLING STYLES
   ============================================ */

.error-message {
    background: rgba(220, 53, 69, 0.1);
    border-left: 4px solid #dc3545;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    border-radius: 4px;
    color: #dc3545;
}

.success-message {
    background: rgba(40, 167, 69, 0.1);
    border-left: 4px solid #28a745;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    border-radius: 4px;
    color: #28a745;
}

.retry-button {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.retry-button:hover {
    background: #f0c800;
    transform: translateY(-1px);
}

/* ============================================
   MENU ANIMATIONS
   ============================================ */

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Active navigation link */
.nav-link.active,
.menu-item.active > a {
    color: var(--primary-color) !important;
    position: relative;
}

.nav-link.active::after,
.menu-item.active > a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* ============================================
   RESPONSIVE IMPROVEMENTS
   ============================================ */

@media (max-width: 576px) {
    .skip-to-main-content {
        font-size: 0.875rem;
        padding: 6px 12px;
    }
    
    .menu-overlay {
        background: rgba(0, 0, 0, 0.85);
    }
}

