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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f0f13;
    color: #e8e8ee;
    height: 100vh;
    overflow: hidden;
    font-size: 15px;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* ========== Сайдбар ========== */
.sidebar {
    width: 360px;
    background: #14141c;
    border-right: 1px solid #252530;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.logo {
    padding: 28px 24px;
    border-bottom: 1px solid #252530;
    background: #0f0f13;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #c084fc, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 0.85rem;
    color: #6b6b80;
    margin-top: 6px;
}

.pack-settings {
    padding: 24px;
    border-bottom: 1px solid #252530;
}

.pack-settings h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a78bfa;
    margin-bottom: 18px;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #9ca3af;
    margin-bottom: 6px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: #1c1c26;
    border: 1px solid #2d2d3a;
    border-radius: 10px;
    color: #e8e8ee;
    font-size: 0.9rem;
    font-family: 'Inter', monospace;
    transition: all 0.2s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.input-group .hint {
    display: block;
    font-size: 0.75rem;
    color: #6b6b80;
    margin-top: 5px;
}

.actions {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #9333ea, #7e22ce);
    color: #ffffff;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #a855f7, #9333ea);
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
}

.btn-secondary {
    background: #1c1c26;
    color: #cbd5e1;
    border: 1px solid #2d2d3a;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #252535;
    border-color: #a855f7;
    color: #d8b4fe;
}

.btn-small {
    background: #1c1c26;
    color: #cbd5e1;
    border: 1px solid #2d2d3a;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #252535;
    color: #c084fc;
    border-color: #a855f7;
}

.file-label {
    display: block;
    cursor: pointer;
}

.status {
    margin-top: auto;
    padding: 20px 24px;
    background: #0f0f13;
    border-top: 1px solid #252530;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.status-item .label {
    color: #9ca3af;
}

.status-item .value {
    font-weight: 600;
    color: #c084fc;
    font-size: 1rem;
}

.warning-message {
    margin-top: 14px;
    padding: 12px;
    background: rgba(168, 85, 247, 0.1);
    border-left: 3px solid #a855f7;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #d8b4fe;
    display: none;
}

.warning-message.show {
    display: block;
}

/* ========== Основной контент ========== */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0f0f13;
}

.toolbar {
    padding: 20px 28px;
    background: #14141c;
    border-bottom: 1px solid #252530;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.search-box input {
    width: 300px;
    padding: 10px 18px;
    background: #1c1c26;
    border: 1px solid #2d2d3a;
    border-radius: 30px;
    color: #e8e8ee;
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: #a855f7;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.groups-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.loader {
    text-align: center;
    padding: 80px;
    color: #6b6b80;
    font-size: 1rem;
}

/* ========== Дерево групп ========== */
.group-item {
    margin-bottom: 8px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #14141c;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.group-header:hover {
    background: #1c1c26;
}

.group-expand {
    font-size: 0.8rem;
    color: #9ca3af;
    width: 22px;
}

.group-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #a855f7;
}

.group-title {
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
}

.group-count {
    font-size: 0.8rem;
    color: #9ca3af;
    background: #1c1c26;
    padding: 4px 10px;
    border-radius: 20px;
}

.subgroups-container {
    margin-left: 34px;
    margin-top: 6px;
    display: none;
}

.subgroups-container.open {
    display: block;
}

/* ========== Подгруппы ========== */
.subgroup-item {
    margin-bottom: 6px;
}

.subgroup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #0f0f13;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.subgroup-header:hover {
    background: #181820;
}

.subgroup-expand {
    font-size: 0.7rem;
    color: #6b6b80;
    width: 20px;
}

.subgroup-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #a855f7;
}

.subgroup-title {
    font-size: 0.9rem;
    flex: 1;
    color: #cbd5e1;
}

.subgroup-count {
    font-size: 0.7rem;
    color: #6b6b80;
}

.emojis-container {
    margin-left: 34px;
    margin-top: 10px;
    margin-bottom: 12px;
    display: none;
    flex-wrap: wrap;
    gap: 12px;
}

.emojis-container.open {
    display: flex;
}

/* ========== Emoji карточки ========== */
.emoji-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #14141c;
    border: 1px solid #252530;
    border-radius: 14px;
    padding: 10px 16px;
    transition: all 0.2s;
    min-width: 280px;
    flex: 0 1 auto;
}

.emoji-card:hover {
    background: #1c1c26;
    border-color: #3a3a50;
}

.emoji-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #a855f7;
}

.emoji-glyph {
    font-size: 1.8rem;
    min-width: 52px;
    text-align: center;
}

.emoji-info {
    flex: 1;
    min-width: 160px;
}

.emoji-description {
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 500;
}

.emoji-codepoint {
    font-size: 0.65rem;
    color: #6b6b80;
    font-family: monospace;
    margin-top: 2px;
}

.emoji-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.alias-badge {
    background: #1c1c26;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.7rem;
    color: #c084fc;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.alias-badge:hover {
    background: #252535;
    color: #e9d5ff;
}

.alias-badge.has-aliases {
    background: #7e22ce;
    color: #ffffff;
}

.alias-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.alias-btn:hover {
    background: #2d2d3a;
}

/* ========== Модальное окно ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #14141c;
    border: 1px solid #2d2d3a;
    border-radius: 20px;
    width: 90%;
    max-width: 550px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #252530;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: #e8e8ee;
}

.modal-header .close {
    font-size: 1.8rem;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
}

.modal-header .close:hover {
    color: #c084fc;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.alias-emoji-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #1c1c26;
    border-radius: 14px;
    margin-bottom: 20px;
}

.alias-emoji-preview span:first-child {
    font-size: 2.5rem;
}

.alias-emoji-preview span:last-child {
    font-size: 0.85rem;
    color: #9ca3af;
}

.alias-list {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.alias-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #1c1c26;
    border-radius: 10px;
    margin-bottom: 8px;
}

.alias-item span {
    font-family: monospace;
    font-size: 0.9rem;
    color: #e8e8ee;
}

.alias-item button {
    background: none;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 8px;
}

.alias-item button:hover {
    color: #ef4444;
}

.alias-empty {
    text-align: center;
    color: #6b6b80;
    padding: 28px;
    font-size: 0.85rem;
}

.alias-add {
    display: flex;
    gap: 10px;
}

.alias-add input {
    flex: 1;
    padding: 10px 14px;
    background: #1c1c26;
    border: 1px solid #2d2d3a;
    border-radius: 10px;
    color: #e8e8ee;
    font-size: 0.85rem;
}

.alias-add input:focus {
    outline: none;
    border-color: #a855f7;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid #252530;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========== Скроллбар ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f0f13;
}

::-webkit-scrollbar-thumb {
    background: #2d2d3a;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a50;
}
