/* ===== СБРОС И БАЗОВЫЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c3e50;
    --primary-dark: #1a252f;
    --secondary: #34495e;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --border: #bdc3c7;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 30px;
}

/* ===== ЗАГОЛОВКИ ===== */
h1 {
    font-size: 2rem;
    font-weight: 300;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    border-bottom: 2px solid var(--light);
    padding-bottom: 15px;
}

h1 i {
    color: var(--accent);
    margin-right: 10px;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

h2, h3 {
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 20px;
}

h2 {
    font-size: 1.5rem;
    border-left: 4px solid var(--accent);
    padding-left: 15px;
}

h3 {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

/* ===== СЕЛЕКТОР ТИПОВ ===== */
.type-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--light);
    border-radius: 6px;
}

.type-btn {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.type-btn i {
    font-size: 1rem;
    color: var(--gray);
}

.type-btn:hover {
    border-color: var(--accent);
    background: #f8f9fa;
}

.type-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.type-btn.active i {
    color: white;
}

.type-btn .badge {
    background: var(--light);
    color: var(--text-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: normal;
    margin-left: 5px;
}

.type-btn.active .badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* ===== СЕКЦИИ ФОРМЫ ===== */
.form-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.form-section h3 i {
    color: var(--accent);
    margin-right: 8px;
}

/* ===== ЭЛЕМЕНТЫ ФОРМЫ ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--secondary);
}

.form-group label i {
    color: var(--accent);
    margin-right: 6px;
    width: 16px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 0.8rem;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--gray);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

input[type="range"] {
    padding: 0;
    height: 6px;
    background: var(--light);
    border-radius: 3px;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow);
}

input[type="color"] {
    height: 40px;
    padding: 4px;
    cursor: pointer;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

/* ===== СЕТКИ ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.color-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.color-row .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* ===== ПРИМЕРЫ ===== */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.example-btn {
    padding: 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text);
    width: 100%;
}

.example-btn i {
    color: var(--accent);
    font-size: 1rem;
    width: 20px;
}

.example-btn:hover {
    border-color: var(--accent);
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* ===== КНОПКИ ===== */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e0e6e8;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* ===== РЕЗУЛЬТАТ ===== */
.result {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result h3 {
    margin-bottom: 20px;
    color: var(--success);
    font-weight: 400;
    width: 100%;
}

.result img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    padding: 10px;
    background: white;
    box-shadow: var(--shadow);
    display: block;
    margin: 0 auto;
}

.result .btn {
    display: inline-block;
    margin-top: 20px;
    text-decoration: none;
}

/* ===== СООБЩЕНИЯ ===== */
.error, .success {
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error {
    background: #fde8e8;
    border: 1px solid var(--danger);
    color: #c0392b;
}

.success {
    background: #e8f8f0;
    border: 1px solid var(--success);
    color: #27ae60;
}

.error i, .success i {
    font-size: 1.1rem;
}

/* ===== ЗНАЧЕНИЯ RANGE ===== */
.range-value {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--light);
    border-radius: 3px;
    font-size: 0.85rem;
    color: var(--text);
}

/* ===== КОМПАКТНАЯ ФОРМА ЦВЕТОВ ===== */
.color-row-compact {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--light);
    padding: 10px 15px;
    border-radius: 6px;
    margin-top: 10px;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.color-item label {
    font-size: 0.9rem;
    color: var(--secondary);
    white-space: nowrap;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.color-item input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.color-item.checkbox {
    flex: 0 0 auto;
}

.color-item.checkbox label {
    cursor: pointer;
    white-space: nowrap;
}

.color-item.checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 4px;
}

/* ===== АНИМАЦИИ ===== */
.conditional-fields {
    display: none;
    animation: fadeIn 0.3s ease;
}

.conditional-fields.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== УТИЛИТЫ ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .subtitle {
        text-align: center;
    }
    
    .type-selector {
        flex-direction: column;
        padding: 10px;
    }
    
    .type-btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
    }
    
    .color-row-compact {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .color-item {
        flex: 1;
    }
    
    .color-item.checkbox {
        justify-content: center;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Центрирование QR-кода на мобильных */
    .result {
        margin-top: 20px;
        padding: 15px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    .result img {
        max-width: 90%;
        height: auto;
        margin: 0 auto;
        display: block;
    }
    
    .result .btn {
        width: auto;
        min-width: 200px;
        margin: 15px auto 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .result img {
        max-width: 100%;
    }
    
    .result .btn {
        width: 100%;
        min-width: auto;
    }
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 8px 8px 0 0;
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.2rem;
}

.modal-header h3 i {
    color: var(--accent);
    margin-right: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray);
    transition: color 0.2s;
    line-height: 1;
    padding: 0 5px;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

/* ===== КНОПКИ ШАРИНГА ===== */
.share-buttons {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.share-btn {
    flex: 1;
    min-width: 120px;
    padding: 15px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.share-btn i {
    font-size: 2rem;
}

.share-btn.telegram {
    background: #0088cc;
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.viber {
    background: #665CAC;
}

/* ===== ССЫЛКА ДЛЯ КОПИРОВАНИЯ ===== */
.share-link {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.share-link p {
    margin-bottom: 10px;
    color: var(--text-light);
}

.link-copy {
    display: flex;
    gap: 10px;
}

.link-copy input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--light);
}

.link-copy button {
    padding: 10px 20px;
    white-space: nowrap;
}

/* ===== РЕЗУЛЬТ ===== */
.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.result-actions .btn {
    flex: 0 1 auto;
    min-width: 140px;
}

/* ===== АДАПТИВНОСТЬ ДЛЯ МОДАЛЬНОГО ОКНА ===== */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 80vh;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .share-btn {
        flex-direction: row;
        justify-content: center;
        padding: 12px;
    }
    
    .share-btn i {
        font-size: 1.5rem;
    }
    
    .link-copy {
        flex-direction: column;
    }
    
    .link-copy button {
        width: 100%;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .result-actions .btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .share-btn {
        padding: 10px;
    }
    
    .share-btn span {
        font-size: 0.9rem;
    }
}

/* ===== НАВИГАЦИЯ ===== */
.nav-links {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light);
    width: 100%;
}

.nav-links-right {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link i {
    color: var(--accent);
}

.nav-link:hover {
    background: var(--light);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent);
    color: white;
}

.nav-link.active i {
    color: white;
}

@media (max-width: 768px) {
    .nav-links {
        justify-content: center;
    }
    
    .nav-links-right {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-link {
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .nav-links-right {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
    }
}