:root {
    --bg-body-light: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-container-light: #ffffff;
    --text-primary-light: #333333;
    --text-secondary-light: #666666;
    --border-light: #e9ecef;
    --bg-header-light: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-header-light: #ffffff;
    
    --bg-body-dark: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 100%);
    --bg-container-dark: #0f172a;
    --text-primary-dark: #f1f5f9;
    --text-secondary-dark: #cbd5e1;
    --border-dark: #334155;
    --bg-header-dark: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --text-header-dark: #ffffff;
}

* {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-dark {
    background: var(--bg-body-dark);
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-end;
}

.theme-toggle-btn {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    outline: none;
    z-index: 1;
}

.theme-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.theme-toggle-btn:hover::before {
    opacity: 1;
}

.theme-toggle-btn:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-toggle-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

.theme-toggle-btn .theme-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 30px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    z-index: 1;
}

.theme-toggle-btn .sun {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.theme-toggle-btn .moon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(180deg) scale(0);
}

.theme-toggle-btn.dark-mode {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-toggle-btn.dark-mode .sun {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-180deg) scale(0);
}

.theme-toggle-btn.dark-mode .moon {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.theme-toggle-btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
    z-index: 0;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.theme-dark .install-container,
.theme-dark .step-content {
    background: #020617;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.theme-dark .install-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.theme-dark h1,
.theme-dark h2,
.theme-dark h3,
.theme-dark h4 {
    color: #f8fafc;
}

.theme-dark .subtitle {
    color: #e2e8f0;
}

.theme-dark .install-progress {
    background: #020617;
    border-bottom-color: #1e293b;
}

.theme-dark .step-number {
    background: #1e293b;
    color: #64748b;
}

.theme-dark .step-label {
    color: #64748b;
}

.theme-dark .step.active .step-label {
    color: #60a5fa;
}

.theme-dark .step.completed .step-label {
    color: #4ade80;
}

.theme-dark .form-card,
.theme-dark .license-card,
.theme-dark .install-options,
.theme-dark .install-result,
.theme-dark .admin-form-container {
    background: #020617;
    border-color: #1e293b;
}

.theme-dark .form-header,
.theme-dark .license-header {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border-bottom-color: #3b82f6;
}

.theme-dark .form-header h3,
.theme-dark .license-header h3 {
    color: #f1f5f9;
}

.theme-dark .form-group label,
.theme-dark .form-group .form-label {
    color: #e2e8f0;
}

.theme-dark .form-control,
.theme-dark .database-form .form-group .form-control {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.theme-dark .form-control:focus,
.theme-dark .database-form .form-group .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.theme-dark .form-control::placeholder,
.theme-dark .database-form .form-group .form-control::placeholder {
    color: #475569;
}

.theme-dark .form-hint {
    color: #64748b;
}

.theme-dark .agreement-section {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #f59e0b;
}

.theme-dark .agreement-checkbox__text {
    color: #fef3c7;
}

.theme-dark .copyright {
    color: #64748b;
}

.theme-dark .environment-notice {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(129, 140, 248, 0.2) 100%);
    border-color: #3b82f6;
    color: #bfdbfe;
}

.theme-dark .error-summary {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #dc2626;
    color: #fecaca;
}

.theme-dark .success-summary {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #22c55e;
    color: #bbf7d0;
}

.theme-dark .info-table,
.theme-dark .table {
    background: #020617;
}

.theme-dark .table th,
.theme-dark .table td {
    border-bottom-color: #1e293b;
    color: #e2e8f0;
}

.theme-dark .table tbody tr:hover {
    background: #0f172a;
}

.theme-dark .info-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
}

.theme-dark .info-table tr.fail-row {
    background-color: rgba(239, 68, 68, 0.2);
}

.theme-dark .info-table tr.fail-row:hover td {
    background-color: rgba(239, 68, 68, 0.25);
}

.theme-dark .help-text {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border-left-color: #3b82f6;
    color: #64748b;
}

.theme-dark .db-test-result.success {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    color: #a7f3d0;
    border-color: #10b981;
}

.theme-dark .db-test-result.error {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    color: #fecaca;
    border-color: #ef4444;
}

.theme-dark .admin-error {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #dc2626;
}

.theme-dark .admin-error-title {
    color: #fecaca;
}

.theme-dark .admin-error-list li {
    color: #fecaca;
}

.theme-dark .admin-success {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #22c55e;
}

.theme-dark .admin-success-title {
    color: #a7f3d0;
}

.theme-dark .admin-success-text {
    color: #6ee7b7;
}

.theme-dark .install-progress-container {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

.theme-dark .progress,
.theme-dark .step5-install .jx-install-progress-track {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-dark .progress-text,
.theme-dark .step5-install .install-progress-text {
    color: #ffffff;
}

.theme-dark .install-log {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
}

.theme-dark .log-entry {
    color: #e2e8f0;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.theme-dark .radio-label {
    background: #020617;
    border-color: #334155;
}

.theme-dark .radio-label:hover {
    border-color: #3b82f6;
    background: #0f172a;
}

.theme-dark .radio-content strong {
    color: #e2e8f0;
}

.theme-dark .radio-content p {
    color: #64748b;
}

.theme-dark .help-section {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border-color: #3b82f6;
}

.theme-dark .help-section h3 {
    color: #bfdbfe;
}

.theme-dark .help-section li {
    color: #64748b;
}

.theme-dark .install-footer {
    background: #020617;
    border-top-color: #1e293b;
}

.theme-dark .system-info {
    color: #64748b;
}

.theme-dark .license-content {
    background: linear-gradient(180deg, #020617 0%, #0f172a 100%);
}

.theme-dark .license-content h2,
.theme-dark .license-content h3 {
    color: #f1f5f9;
}

.theme-dark .license-content p {
    color: #94a3b8;
}

.theme-dark .license-content .company-info {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border-color: #3b82f6;
}

.theme-dark .license-content .company-info a {
    color: #60a5fa;
}

.theme-dark .license-content .company-info a:hover {
    color: #fff;
    background: #3b82f6;
}

.theme-dark .welcome-header,
.theme-dark .page-header,
.theme-dark .section-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #4f46e5 100%);
}

.theme-dark .section-title-1 {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.theme-dark .welcome-title,
.theme-dark .page-header-title,
.theme-dark .section-title {
    color: #fff !important;
}

.theme-dark .welcome-subtitle,
.theme-dark .page-header-subtitle,
.theme-dark .section-subtitle {
    color: rgba(255, 255, 255, 0.95);
}

.theme-dark .form-card,
.theme-dark .license-card {
    background: #020617;
    border-color: #1e293b;
}

.theme-dark .license-header {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
}

.theme-dark .license-header h3 {
    color: #f1f5f9;
}

.theme-dark .result-title {
    color: #f1f5f9;
}

.theme-dark .result-message {
    color: #94a3b8;
}

.theme-dark .result-details {
    background: #0f172a;
    border-color: #3b82f6;
}

.theme-dark .result-details p {
    color: #a7f3d0;
}

.theme-dark .toggle-password {
    color: #64748b;
}

.theme-dark .toggle-password:hover {
    color: #60a5fa;
    background: #0f172a;
}

@media (max-width: 768px) {
    .theme-switch-wrapper {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    .theme-toggle-btn {
        width: 54px;
        height: 54px;
    }
    
    .theme-toggle-btn .theme-icon {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .theme-switch-wrapper {
        gap: 8px;
    }
    
    .theme-toggle-btn {
        width: 48px;
        height: 48px;
    }
    
    .theme-toggle-btn .theme-icon {
        font-size: 20px;
    }
}
