* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-theme {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: #e2e8f0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: background-color 0.3s;
}

.dark-theme .container {
    background: #2d3748;
}

header {
    background: #4a5568;
    color: white;
    padding: 20px;
    position: relative;
}

.dark-theme header {
    background: #1a202c;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-text {
    flex: 1;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.description {
    font-size: 1rem;
    opacity: 0.8;
}

/* Стили для переключателя темы */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4299e1;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ========== УВЕДОМЛЕНИЯ ========== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
    font-weight: 500;
}

.notification.error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.notification.warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

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

.content {
    padding: 20px;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.dark-theme .tabs {
    border-bottom-color: #4a5568;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    background: none;
    border: none;
    font-size: 16px;
    color: #4a5568;
}

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

.tab:hover {
    background: #f7fafc;
}

.dark-theme .tab:hover {
    background: #4a5568;
}

.tab.active {
    border-bottom: 3px solid #667eea;
    color: #667eea;
    background: #f7fafc;
}

.dark-theme .tab.active {
    color: #90cdf4;
    border-bottom-color: #90cdf4;
    background: #4a5568;
}

.form-container {
    display: none;
}

.form-container.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

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

input, textarea, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 1rem;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
    font-family: inherit;
}

.dark-theme input,
.dark-theme textarea,
.dark-theme select {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dark-theme input:focus,
.dark-theme textarea:focus,
.dark-theme select:focus {
    border-color: #90cdf4;
    box-shadow: 0 0 0 3px rgba(144, 205, 244, 0.1);
}

.placeholder-input::placeholder {
    color: #a0aec0;
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* ========== КНОПКИ ========== */
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.3s;
}

.compact-btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
    border-radius: 5px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 40px !important;
    margin: 5px !important;
    text-decoration: none !important;
}

/* Основные стили для всех кнопок */
.btn-generate,
.copy-btn,
.download-btn,
.add-server-btn,
.remove-server {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.btn-generate:hover,
.copy-btn:hover,
.download-btn:hover,
.add-server-btn:hover,
.remove-server:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Специфичные стили для каждой кнопки */
.btn-generate {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.dark-theme .btn-generate {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.btn-generate:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
}

.dark-theme .btn-generate:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.add-server-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-bottom: 20px;
}

.dark-theme .add-server-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.add-server-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #5a4890 100%);
}

.dark-theme .add-server-btn:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
}

.copy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.copy-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #5a4890 100%);
}

.dark-theme .copy-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.download-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.download-btn:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.dark-theme .download-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.remove-server {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    font-size: 12px !important;
    padding: 5px 10px !important;
    min-height: 30px !important;
}

.remove-server:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
}

.dark-theme .remove-server {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.result-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* ========== УНИВЕРСАЛЬНАЯ ФОРМА ========== */
.universal-server-container {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #f8f9fa;
    transition: background-color 0.3s, border-color 0.3s;
}

.dark-theme .universal-server-container {
    background: #4a5568;
    border-color: #718096;
}

.universal-server-container h4 {
    margin-bottom: 15px;
    color: #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.dark-theme .universal-server-container h4 {
    color: #e2e8f0;
}

.type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.wireguard-badge {
    background-color: #4299e1;
}

.amnezia-badge {
    background-color: #48bb78;
}

.vless-badge {
    background-color: #3B82F6;
}

.hysteria-badge {
    background-color: #8B5CF6;
}

.trojan-badge {
    background-color: #EF4444;
}

.other-badge {
    background-color: #6B7280;
}

/* ========== РЕЗУЛЬТАТЫ ОПРЕДЕЛЕНИЯ ТИПА ========== */
.detection-result {
    margin: 10px 0;
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    color: #333;
}

.dark-theme .detection-result {
    background: #2d3748;
    color: #e2e8f0;
    border: 1px solid #4a5568;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.detection-result strong {
    color: #4a5568;
    font-weight: 600;
}

.dark-theme .detection-result strong {
    color: #e2e8f0;
    opacity: 0.95;
}

.detected-type-text {
    font-weight: bold;
    color: #3182ce;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.dark-theme .detected-type-text {
    color: #90cdf4;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ========== РЕЗУЛЬТАТЫ ========== */
.result-container {
    margin-top: 30px;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

.dark-theme .result-container {
    border-top-color: #4a5568;
}

.result {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 20px;
    margin-top: 10px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-height: 600px;
    overflow-y: auto;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
    line-height: 1.5;
}

.dark-theme .result {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* ========== ПАРСИНГ РЕЗУЛЬТАТОВ ========== */
.parse-details {
    background: #f0f4f8;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    transition: background-color 0.3s, border-color 0.3s;
}

.dark-theme .parse-details {
    background: #4a5568;
    border-color: #718096;
}

.parse-details h4 {
    margin-bottom: 10px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-theme .parse-details h4 {
    color: #e2e8f0;
}

.parse-details pre {
    background: #f7fafc;
    color: #2d3748;
    padding: 10px;
    border-radius: 3px;
    margin-top: 5px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.4;
    border: 1px solid #e2e8f0;
}

.dark-theme .parse-details pre {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 5px;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #ccc;
}

/* ========== ИНФОРМАЦИОННЫЕ БЛОКИ ========== */
.config-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
    transition: background-color 0.3s;
}

.dark-theme .config-section {
    background: #4a5568;
    border-left-color: #90cdf4;
}

.config-section h3 {
    margin-bottom: 15px;
    color: #4a5568;
}

.dark-theme .config-section h3 {
    color: #e2e8f0;
}

.info-block {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin: 25px 0;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dark-theme .info-block {
    background: #4a5568;
    border-left-color: #90cdf4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-block strong {
    display: block;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #4a5568;
    line-height: 1.4;
}

.dark-theme .info-block strong {
    color: #e2e8f0;
}

.info-block pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid #4a5568;
}

.dark-theme .info-block pre {
    background: #1a202c;
    border-color: #718096;
}

.info-block a {
    color: #3182ce;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.3s;
}

.dark-theme .info-block a {
    color: #90cdf4;
}

.info-block a:hover {
    color: #2c5aa0;
    text-decoration: none;
}

.dark-theme .info-block a:hover {
    color: #63b3ed;
}

.info-block.warn {
    border-left-color: #e53e3e;
    background: #fed7d7;
}

.dark-theme .info-block.warn {
    background: #443322;
    border-left-color: #ed8936;
}

.dark-theme .info-block.warn strong {
    color: #ed8936;
}

/* Специальные информационные блоки */
.info-block.hys2-info {
    background: #e8f4fd;
    border-left: 4px solid #3182ce;
}

.dark-theme .info-block.hys2-info {
    background: #2a4365;
    border-left-color: #4299e1;
}

.info-block.xkeen-install-info {
    background: #f0fff4;
    border-left: 4px solid #48bb78;
}

.dark-theme .info-block.xkeen-install-info {
    background: #2d4530;
    border-left-color: #48bb78;
}

/* ========== СКРИНШОТ ========== */
.screenshot {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    margin: 25px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 3px solid #e2e8f0;
}

.dark-theme .screenshot {
    border-color: #4a5568;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.screenshot:hover {
    transform: scale(1.01);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.dark-theme .screenshot:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .theme-toggle {
        justify-content: center;
    }
    
    h1 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .description {
        text-align: center;
    }
    
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }
    
    .tab {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .universal-server-container h4 {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .remove-server {
        align-self: flex-end;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .result-buttons .compact-btn {
        width: 100%;
        margin: 5px 0 !important;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .compact-btn {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }
    
    .info-block {
        padding: 15px;
        margin: 20px 0;
    }
    
    .config-section {
        padding: 15px;
    }
    
    .detection-result {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 8px;
    }
    
    header {
        padding: 15px;
    }
    
    .content {
        padding: 15px;
    }
    
    .notification {
        max-width: calc(100% - 40px);
        left: 20px;
        right: 20px;
        top: 10px;
    }
    
    .detection-result {
        padding: 8px 10px;
        font-size: 12px;
    }
}