/* assets/style.css */
:root {
    --bg: #f9fafb;
    --bg-card: #ffffff;
    --text: #333333;
    --text-secondary: #4a5568;
    --border: #edf2f7;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --error: #e53e3e;
    --success: #38a169;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

body.dark-theme {
    --bg: #1a1a1a;
    --bg-card: #2d2d2d;
    --text: #e2e2e2;
    --text-secondary: #a0aec0;
    --border: #444444;
    --shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3 {
    margin-bottom: 16px;
    color: var(--text);
}

form {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    transition: background 0.3s, border-color 0.3s;
}

input, textarea, button {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-card);
    color: var(--text);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

button[type="submit"] {
    background-color: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

button[type="submit"]:hover {
    background-color: var(--accent-hover);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.error {
    color: var(--error);
    background: #fef2f2;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid var(--error);
}

.success {
    color: var(--success);
    background: #f0fff4;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid var(--success);
}

/* === Универсальные кнопки === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-card);
    color: var(--accent);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.btn-secondary:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* === Круглая кнопка темы в углу === */
.theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    transform: rotate(15deg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.controls-row {
    text-align: center;
    margin: 20px 0;
}

.preview-section {
    display: none;
    margin-top: 20px;
}

.preview-section.visible {
    display: block;
}

.preview {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 10px;
    margin: 16px 0;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.preview h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 16px;
    color: var(--text-secondary);
}

.preview img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

/* === Иконки платформ в предпросмотре === */
.preview-platform-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 8px;
    display: inline-block;
}

/* === Платформы — карточки выбора === */
.platforms {
    display: flex;
    gap: 20px;
    margin: 24px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.platform-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 12px;
    border-radius: 16px;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 96px;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.platform-icon-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
}

.platform-icon {
    width: 100%;
    height: 100%;
    display: block;
}

.check-mark {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #4C75A8;
    color: white;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    border-radius: 50%;
}

.platform-item[data-platform="vk"] .check-mark {
    background: #4C75A8;
}
.platform-item[data-platform="tg"] .check-mark {
    background: #0088cc;
}
.platform-item[data-platform="zen"] .check-mark {
    background: #ff3347;
    border-radius: 4px;
}

.platform-item input[type="checkbox"]:checked ~ .platform-icon-wrapper .check-mark {
    opacity: 1;
    transform: scale(1);
}

.platform-item input[type="checkbox"]:checked ~ .platform-label {
    font-weight: 600;
}

.platform-item[data-platform="vk"] input[type="checkbox"]:checked ~ .platform-icon-wrapper {
    box-shadow: 0 0 0 4px rgba(76, 117, 168, 0.3);
}
.platform-item[data-platform="tg"] input[type="checkbox"]:checked ~ .platform-icon-wrapper {
    box-shadow: 0 0 0 4px rgba(0, 136, 204, 0.3);
}
.platform-item[data-platform="zen"] input[type="checkbox"]:checked ~ .platform-icon-wrapper {
    box-shadow: 0 0 0 4px rgba(255, 51, 71, 0.3);
}

.platform-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.platform-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* === Цвет иконок в тёмной теме === */
body.dark-theme .platform-icon,
body.dark-theme .preview-platform-icon {
    filter: brightness(0) invert(1);
}

/* === Футер с кнопкой выхода === */
.footer {
    margin-top: 40px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Адаптивность */
@media (max-width: 600px) {
    body { padding: 12px; }
    form { padding: 16px; }
    .theme-toggle-btn {
        top: 12px;
        right: 12px;
    }
    .platforms {
        gap: 12px;
    }
    .platform-item {
        min-width: 80px;
        padding: 12px 8px;
    }
    .preview-platform-icon {
        width: 16px;
        height: 16px;
    }
}