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

:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --container-bg: white;
    --border-color: #ddd;
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --secondary-color: #95a5a6;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --code-bg: #f8f9fa;
    --input-bg: white;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --container-bg: #2d2d2d;
    --border-color: #444;
    --primary-color: #4a9fe3;
    --primary-hover: #357abd;
    --secondary-color: #7f8c8d;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --code-bg: #3d3d3d;
    --input-bg: #3d3d3d;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.pasteEntity-content {
    margin-top: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    padding-top: 0; /* Убираем большой отступ, так как используем флекс */
}

.header-top {
    display: flex;
    justify-content: space-between; /* Разносит элементы по краям */
    align-items: center;
    margin-bottom: 20px;
    min-height: 44px;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.paste-info {
    color: var(--secondary-color);
    font-size: 14px;
}

/* Theme Switch */
.theme-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-switch-label {
    font-size: 14px;
    color: var(--text-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-color);
    transition: .4s;
    border-radius: 34px;
}

/* Кружок-ползунок (без иконок!) */
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: #ffffff;
    transition: .4s;
    border-radius: 50%;
}

/* ОДНА иконка на треке */
.slider:after {
    content: "☀️";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    line-height: 1;
    transition: opacity 0.3s;
    opacity: 1;
    pointer-events: none;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

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

/* В темной теме показываем луну и переносим вправо */
input:checked + .slider:after {
    content: "🌙";
    left: 36px;
}

/* User icon area */

.user-area {
    display: grid;
    grid-auto-flow: column; /* Элементы в ряд */
    align-items: center;    /* Центрирование по вертикали - ГАРАНТИРОВАНО */
    gap: 12px;
    height: 34px;           /* Высота как у кнопки */
}

.user-name-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;         /* Убираем влияние межстрочных интервалов */
    display: block;
    white-space: nowrap;
}

.user-name-link:hover {
    color: var(--primary-color);
}

.user-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--container-bg);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    padding: 0;
}

.user-icon-button svg {
    fill: var(--text-color);
}

.user-icon-button:hover {
    border-color: var(--primary-color);
    background: var(--code-bg);
}

/* Dropdown Logic */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background-color: var(--container-bg);
    min-width: 160px;
    box-shadow: var(--shadow);
    z-index: 1001;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: var(--code-bg);
    color: var(--primary-color);
}

.show {
    display: block;
}

/* Forms */
.paste-form {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

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

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
}

textarea, select, input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.3s;
}

textarea:focus, select:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: background-color 0.3s;
    color: white;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #6c757d;
}

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

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-copy {
    background-color: var(--success-color);
}

.btn-copy:hover {
    background-color: #219a52;
}

/* PasteEntity Content */
.paste-content {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.paste-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
}

/* PasteEntity Actions */
.paste-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Share Section */
.share-section {
    background: var(--container-bg);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.share-url {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.share-url input {
    flex: 1;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.error {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 5px;
}

/* Character Counter */
.character-counter {
    font-size: 12px;
    color: var(--secondary-color);
    text-align: right;
    margin-top: 5px;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 15px 25px;
    border-radius: 50px;
    z-index: 2000;
    display: none; /* Скрыт по умолчанию */
    width: max-content;
    max-width: 90%;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.btn-sm {
    padding: 5px 15px;
    font-size: 12px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

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

footer a:hover {
    text-decoration: underline;
}

.footer-copyright a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer-copyright a:hover {
    text-decoration: underline;
}

.error-container {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    text-align: center;
    margin: 20px 0;
}

.error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.alert h2 {
    margin-bottom: 10px;
    color: inherit;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .paste-actions {
        flex-direction: column;
    }

    .share-url {
        flex-direction: column;
    }

    .theme-switch {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
    }

    .footer-content {
        flex-direction: column;
        gap: 10px;
    }

    header {
        padding-top: 0;
    }
}