/* Glassmorphism и современная цветовая палитра */

:root {
    /* Градиентные цвета фона */
    --bg-gradient-start: #0a0e27;
    --bg-gradient-end: #1a1f3a;
    --bg-gradient-accent: #2d1b4e;
    
    /* Glassmorphism цвета */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.08);
    
    /* Акцентные цвета с градиентами */
    --accent-blue: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-purple: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-cyan: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --accent-green: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --accent-orange: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Тени с свечением */
    --glow-blue: 0 0 20px rgba(102, 126, 234, 0.3);
    --glow-purple: 0 0 20px rgba(245, 87, 108, 0.3);
    --glow-cyan: 0 0 20px rgba(79, 172, 254, 0.3);
}

html {
    font-size: 14px;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, #0f1528 25%, var(--bg-gradient-end) 50%, #252a4a 75%, var(--bg-gradient-accent) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    background: transparent;
}

/* Glassmorphism базовые классы */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.glass-hover:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.5);
}

.glass-card {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15),
                0 0 30px rgba(102, 126, 234, 0.2);
}

.glass-nav {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.3);
}

.glass-button {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(110, 100, 200, 0.8) 50%, rgba(118, 75, 162, 0.8) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px 0 rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.glass-button:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 1) 0%, rgba(110, 100, 200, 1) 50%, rgba(118, 75, 162, 1) 100%);
    box-shadow: 0 6px 20px 0 rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

.glass-input {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1),
                0 0 20px rgba(102, 126, 234, 0.2);
    outline: none;
}

/* Градиентные акценты */
.gradient-blue {
    background: var(--accent-blue);
}

.gradient-purple {
    background: var(--accent-purple);
}

.gradient-cyan {
    background: var(--accent-cyan);
}

.gradient-green {
    background: var(--accent-green);
}

.gradient-orange {
    background: var(--accent-orange);
}

/* Эффекты свечения */
.glow-blue {
    box-shadow: var(--glow-blue);
}

.glow-purple {
    box-shadow: var(--glow-purple);
}

.glow-cyan {
    box-shadow: var(--glow-cyan);
}

/* Toast Notifications с glassmorphism */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: rgba(31, 41, 55, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid #43e97b;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
                0 0 20px rgba(67, 233, 123, 0.3);
}

.toast.error {
    border-left: 4px solid #f5576c;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
                0 0 20px rgba(245, 87, 108, 0.3);
}

.toast.warning {
    border-left: 4px solid #fee140;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
                0 0 20px rgba(254, 225, 64, 0.3);
}

.toast.info {
    border-left: 4px solid #4facfe;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
                0 0 20px rgba(79, 172, 254, 0.3);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    font-size: 18px;
    line-height: 1;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
    font-size: 14px;
}

.toast-message {
    color: #d1d5db;
    font-size: 13px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
    font-size: 20px;
    line-height: 1;
}

.toast-close:hover {
    color: #ffffff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.loading-overlay-content {
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 200px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.loading-overlay-text {
    color: #ffffff;
    font-size: 14px;
}

/* Fix placeholder text on mobile */
input::placeholder,
textarea::placeholder {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 640px) {
    html {
        font-size: 13px;
    }
    
    input::placeholder,
    textarea::placeholder {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .toast-container {
        max-width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        top: 12px;
        gap: 8px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
        padding: 12px;
        gap: 8px;
    }
    
    .toast-icon {
        width: 16px;
        height: 16px;
        font-size: 14px;
    }
    
    .toast-title {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .toast-message {
        font-size: 11px;
    }
    
    .toast-close {
        width: 16px;
        height: 16px;
        font-size: 16px;
    }
    
    nav .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    nav .h-16 {
        height: 3rem;
    }
    
    nav a.text-xl {
        font-size: 1.125rem;
    }
    
    button,
    a[class*="bg-"] {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .bg-gray-800.rounded-lg {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    h3.text-lg {
        font-size: 1rem;
    }
    
    .text-sm {
        font-size: 0.75rem;
    }
    
    .space-y-4 > * + * {
        margin-top: 0.75rem;
    }
    
    .space-y-2 > * + * {
        margin-top: 0.375rem;
    }
    
    .fixed.inset-0 .bg-gray-800 {
        padding: 1rem;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    select,
    textarea {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    svg.h-6.w-6 {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    footer {
        padding: 0.75rem;
        font-size: 0.75rem;
    }
    
    .loading-overlay-content {
        padding: 16px;
        min-width: 160px;
    }
    
    .loading-overlay-text {
        font-size: 12px;
    }
    
    .loading-spinner {
        width: 16px;
        height: 16px;
        border-width: 2px;
    }
}

/* Унифицированное раскрытие списков */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Анимации для glassmorphism */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.glass-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}
