/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* Live Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 100px;
    z-index: 1000;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 99, 235, 0.5);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    color: white;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    font-weight: bold;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.chat-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.8rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background: var(--secondary-color);
}

.chat-bubble {
    background: var(--lighter-bg);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 70%;
    color: var(--text-dark);
    line-height: 1.5;
}

.chat-message.user .chat-bubble {
    background: var(--primary-color);
    color: white;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.8rem;
}

.chat-input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    background: var(--lighter-bg);
    color: var(--text-dark);
    font-size: 14px;
}

.chat-send {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    background: var(--secondary-color);
}

/* Newsletter Popup */
.newsletter-popup {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    padding-top: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    z-index: 1000;
    transform: translateX(-500px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.newsletter-popup.show {
    transform: translateX(0);
}

.newsletter-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    z-index: 1001;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.newsletter-close:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.newsletter-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* Dark mode for newsletter close button */
[data-theme="dark"] .newsletter-close {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

[data-theme="dark"] .newsletter-close:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.newsletter-popup h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.newsletter-popup p {
    color: var(--text-medium);
    margin-bottom: 1.5rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.newsletter-form input {
    padding: 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--lighter-bg);
    color: var(--text-dark);
}

.newsletter-form button {
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--lighter-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1.5rem;
    color: var(--text-medium);
    font-size: 1.1rem;
}

/* Cookie Consent */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 1.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-light);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.cookie-consent.show {
    transform: translateY(0);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 1;
    color: var(--text-medium);
}

.cookie-text a {
    color: var(--primary-color);
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
}

.cookie-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cookie-accept {
    background: var(--primary-color);
    color: white;
}

.cookie-decline {
    background: var(--lighter-bg);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}

/* Floating Action Button */
.fab-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    z-index: 999;
}

.fab-button {
    width: 56px;
    height: 56px;
    background: var(--accent-color);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
    transition: all 0.3s ease;
}

.fab-button:hover {
    transform: scale(1.1);
}

.fab-button svg {
    width: 24px;
    height: 24px;
    color: white;
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.fab-container.open .fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.fab-item-button {
    width: 48px;
    height: 48px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.fab-item:hover .fab-item-button {
    background: var(--primary-color);
    color: white;
}

.fab-item-label {
    background: var(--card-bg);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 40px);
        right: 20px;
    }
    
    .newsletter-popup {
        width: calc(100vw - 40px);
        left: 20px;
    }
    
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Portfolio Filters */
.portfolio-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.filter-btn {
    padding: 0.7rem 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: 25px;
    color: var(--text-medium);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Testimonial Carousel */
.testimonials-grid {
    position: relative;
    min-height: 300px;
}

.testimonial-card {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

.testimonial-card.active {
    opacity: 1;
    position: relative;
    pointer-events: all;
}

.testimonial-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
}

.testimonial-prev,
.testimonial-next {
    width: 45px;
    height: 45px;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    color: var(--text-dark);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.testimonial-prev:hover,
.testimonial-next:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.testimonial-dots {
    display: flex;
    gap: 0.8rem;
}

.testimonial-dot {
    width: 12px;
    height: 12px;
    background: var(--border-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.testimonial-dot:hover {
    background: var(--text-light);
    transform: scale(1.2);
}

.testimonial-dot.active {
    background: var(--primary-color);
    width: 30px;
    border-radius: 6px;
}

/* Form Validation Styles */
input.error,
textarea.error,
select.error {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

.field-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.field-error::before {
    content: '⚠';
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Social Share Buttons */
.social-share-fixed {
    position: fixed;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.social-share-fixed.visible {
    opacity: 1;
    visibility: visible;
}

.share-btn {
    width: 45px;
    height: 45px;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-medium);
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

.share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-btn[data-platform="facebook"]:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: white;
}

.share-btn[data-platform="twitter"]:hover {
    background: #1da1f2;
    border-color: #1da1f2;
    color: white;
}

.share-btn[data-platform="linkedin"]:hover {
    background: #0a66c2;
    border-color: #0a66c2;
    color: white;
}

.share-btn[data-platform="copy"]:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Blog Progress Bar */
.blog-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--border-light);
    overflow: hidden;
}

.blog-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.blog-card:hover .blog-progress-bar {
    width: 100%;
}

/* Animate In Classes */
.animate-in {
    animation: slideInUp 0.6s ease forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Keyboard Navigation Styles */
body.keyboard-nav *:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    .back-to-top,
    .chat-widget,
    .fab-container,
    .newsletter-popup,
    .cookie-consent,
    .social-share-fixed,
    .scroll-progress,
    #particleCanvas,
    .animated-bg,
    .grid-overlay {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .section {
        page-break-inside: avoid;
    }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Tooltip Styles */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background: var(--text-dark);
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text-dark);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .social-share-fixed {
        left: 15px;
    }
    
    .share-btn {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .social-share-fixed {
        display: none;
    }
    
    .portfolio-filters {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .testimonial-prev,
    .testimonial-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .testimonial-nav {
        gap: 1rem;
    }
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* 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;
    }
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    z-index: 9998;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 3px solid var(--primary-color);
}

.install-banner.show {
    transform: translateY(0);
}

.install-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.install-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.install-text {
    flex: 1;
}

.install-text strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}

.install-text p {
    color: var(--text-medium);
    font-size: 0.9rem;
    margin: 0;
}

.install-btn {
    padding: 0.8rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.install-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.install-close {
    width: 35px;
    height: 35px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.install-close:hover {
    color: var(--text-dark);
    transform: rotate(90deg);
}

/* Network Status Indicator */
.network-status {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 0.8rem 1.2rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.network-status.show {
    opacity: 1;
    visibility: visible;
}

.network-status.slow {
    border-left: 4px solid #ef4444;
}

.network-status.fast {
    border-left: 4px solid #10b981;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--lighter-bg) 50%, var(--border-light) 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; }
}

/* Image Lazy Loading Placeholder */
img[data-src] {
    background: var(--border-light);
    min-height: 200px;
}

/* Scroll Snap for Sections */
@media (min-width: 1024px) {
    html {
        scroll-snap-type: y proximity;
    }
    
    section {
        scroll-snap-align: start;
    }
}

/* Focus Visible for Better Accessibility */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #1e40af;
        --text-dark: #000000;
        --border-color: #000000;
    }
}

/* Dark Mode Enhancements */
[data-theme="dark"] .install-banner {
    background: #1e293b;
    border-top-color: #3b82f6;
}

[data-theme="dark"] .install-text strong {
    color: #f1f5f9;
}

[data-theme="dark"] .install-text p {
    color: #94a3b8;
}

[data-theme="dark"] .install-close {
    color: #64748b;
}

[data-theme="dark"] .install-close:hover {
    color: #f1f5f9;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .install-content {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .install-icon {
        font-size: 2rem;
    }
    
    .install-text {
        flex: 1 1 100%;
    }
    
    .install-btn {
        flex: 1;
        padding: 0.7rem 1.5rem;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .portfolio-filters {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .filter-btn {
        flex-shrink: 0;
    }
}
