/* Custom Website Styles */

/* CSS переменные для лучшей производительности */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #8b5cf6;
    --accent-color: #0ea5e9;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-vera: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
}

.dark {
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --bg-card: rgba(15, 23, 42, 0.95);
    --bg-glass: rgba(31, 41, 55, 0.8);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Базовые утилиты */
.gpu-accelerated {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.smooth-text {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Text utilities */
.text-optimized-primary {
    color: var(--text-primary);
}

.text-optimized-secondary {
    color: var(--text-secondary);
}

/* Градиенты для текста */
.gradient-text-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-secondary {
    background: linear-gradient(135deg, #10b981, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glass morphism effect */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

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

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in-up-delay-1 {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.fade-in-up-delay-2 {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* =============== RESPONSIVE UTILITIES =============== */

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    /* Typography */
    .hero-title, h1 {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }

    .hero-subtitle, h2 {
        font-size: 1rem !important;
        line-height: 1.4;
    }

    h3 {
        font-size: 1.125rem !important;
    }

    p, .text-base {
        font-size: 0.875rem;
    }

    /* Containers */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Buttons */
    .btn-primary, .btn-secondary {
        padding: 10px 16px !important;
        font-size: 0.875rem !important;
        width: 100%;
        text-align: center;
    }

    /* Cards */
    .vpn-card, .stats-card, .feature-card, .glass-card {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }

    /* Forms */
    .form-input {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Navigation */
    .nav-link {
        padding: 0.5rem !important;
        font-size: 0.875rem;
    }

    /* Hide decorative elements on very small screens */
    .hide-on-mobile {
        display: none !important;
    }

    /* Stack flex items */
    .flex {
        flex-direction: column !important;
    }

    .flex.keep-row {
        flex-direction: row !important;
    }

    /* Grid to single column */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Full width elements */
    .mobile-full-width {
        width: 100% !important;
    }

    /* Reduced spacing */
    .space-y-8 > * + * {
        margin-top: 1.5rem !important;
    }

    .space-y-6 > * + * {
        margin-top: 1rem !important;
    }

    /* Scrollable tables */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Mobile Devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .hero-title {
        font-size: 2.25rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .btn-primary, .btn-secondary {
        padding: 11px 20px;
    }

    /* 2-column grid on tablets */
    .grid.tablet-2-col {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Tablets and Small Desktops (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-title {
        font-size: 2.75rem;
    }

    .container {
        max-width: 720px;
    }

    /* 3-column grid on small desktops */
    .grid.desktop-3-col {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    button, a, input[type="button"], input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .vpn-card:hover::before,
    .nav-link:hover::after {
        display: none;
    }

    /* Better button spacing */
    button + button, a.btn + a.btn {
        margin-top: 0.75rem;
    }

    /* Prevent zoom on inputs */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Larger tap targets for links */
    a {
        padding: 0.25rem;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce vertical spacing */
    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .vpn-card, .stats-card {
        padding: 1rem;
    }

    .py-20, .py-16, .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .vpn-card, .stats-card, .glass-card {
        border-width: 0.5px;
    }

    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print Styles */
@media print {
    /* Hide interactive elements */
    button, .btn-primary, .btn-secondary, nav, .nav-link {
        display: none !important;
    }

    /* Remove backgrounds */
    .vpn-card, .stats-card, .glass-card {
        background: white !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }

    /* Optimize for print */
    body {
        background: white !important;
        color: black !important;
    }

    a {
        text-decoration: underline !important;
    }

    /* Page breaks */
    .vpn-card, .stats-card {
        page-break-inside: avoid;
    }
}

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

    .fade-in-up, .fade-in-up-delay-1, .fade-in-up-delay-2 {
        animation: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary, .btn-secondary {
        border: 2px solid currentColor;
    }

    .vpn-card, .stats-card, .glass-card {
        border: 2px solid currentColor;
    }
}

/* Utility Classes for Responsive Design */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .mobile-center {
        text-align: center !important;
        margin-left: auto;
        margin-right: auto;
    }

    .mobile-stack {
        flex-direction: column !important;
    }

    .mobile-hide {
        display: none !important;
    }
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid #667eea;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status indicators */
.status-active {
    color: #10b981;
}

.status-inactive {
    color: #ef4444;
}

.status-pending {
    color: #f59e0b;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Form styles */
.form-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    width: 100%;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Navigation improvements */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* Card hover effects */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* VPN Card */
.vpn-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.vpn-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.vpn-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.05), transparent);
    transition: left 0.6s;
}

.vpn-card:hover::before {
    left: 100%;
}

/* Stats Card */
.stats-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    text-align: center;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Hover effects */
@media (hover: hover) and (pointer: fine) {
    .hover-scale:hover {
        transform: scale(1.02);
    }

    .hover-lift:hover {
        transform: translateY(-4px);
    }
}