* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

#bgVdo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -2;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    z-index: -1;
}

/* --- Скрытие всего интерфейса --- */
body.interface-hidden .app-container,
body.interface-hidden .overlay,
body.interface-hidden #toast,
body.interface-hidden .login-wrapper {
    display: none !important;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 300px;
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(14px);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Десктопные кнопки */
.desktop-bottom {
    display: flex;
    gap: 6px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.desktop-bottom button {
    flex: 1;
    font-size: 11px;
    padding: 8px 4px;
    text-align: center;
}

.mobile-top-buttons {
    display: none;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #1b79c5;
    color: #000;
    border-color: #1b79c5;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    color: #ccc;
    background: transparent;
    transition: background 0.2s;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.category-item.active {
    background: #1b79c5;
    color: #000;
    font-weight: 600;
}

.category-item.dragging {
    opacity: 0.4;
}

.category-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.category-item:hover .item-actions,
.snippet-card:hover .item-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    opacity: 0.7;
}

.action-btn:hover {
    opacity: 1;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.content-header h1 {
    font-size: 24px;
    font-weight: 600;
    white-space: nowrap;
}

/* === СЕТКА В СТИЛЕ PINTEREST === */
.blocks-grid {
    column-count: 5;
    column-gap: 20px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 1680px) {
    .blocks-grid { column-count: 4; }
}
@media (max-width: 1480px) {
    .blocks-grid { column-count: 3; }
}
@media (max-width: 1180px) {
    .blocks-grid { column-count: 2; }
}
@media (max-width: 980px) {
    .blocks-grid { column-count: 1; }
}

.snippet-card {
    background: rgb(30 30 30 / 52%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
    
    width: 100%;
    min-width: 250px;
    display: inline-block;
    margin-bottom: 20px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.snippet-card.dragging {
    opacity: 0.4;
}

.snippet-card:hover {
    border-color: #1b79c5;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.snippet-card h3 {
    font-size: 16px;
    color: #1b79c5;
    overflow-wrap: anywhere;
}

.snippet-card code {
    display: block;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    color: #ddd;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.card-footer {
    display: flex;
    justify-content: flex-between;
    align-items: center;
}

.btn-copy {
    background: #1b79c521;
    border: 1px solid #1b79c5;
    color: #1b79c5;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #1b79c5;
    color: #000;
}

.edit-input, .edit-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #1b79c5;
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    margin-bottom: 8px;
}

.edit-textarea {
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
    min-height: 70px;
}

.edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-save {
    background: #1b79c5;
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.btn-save:hover { background: #1b79c5; }
.btn-cancel:hover { background: rgba(255, 255, 255, 0.2); }

#toast {
    visibility: hidden;
    min-width: 200px;
    background-color: #1b79c5;
    color: #000;
    text-align: center;
    border-radius: 8px;
    padding: 12px;
    position: fixed;
    z-index: 100;
    right: 30px;
    bottom: 30px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: visibility 0.2s, opacity 0.2s;
    opacity: 0;
}

#toast.show {
    visibility: visible;
    opacity: 1;
}

.icon {
    width: 15px;
    height: 15px;
    vertical-align: bottom;
}

@font-face {
    font-family: 'MyEthnocentric';
    src: url('fonts/ethnocentricrus.otf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.logo-supido {
    font-family: 'MyEthnocentric', sans-serif;
    font-size: 45px;
    font-weight: normal;
    letter-spacing: 1px;
    background: #1b79c5;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 2px 10px rgba(0, 200, 151, 0.2));
    text-align: center;
    user-select: none;
}

/* --- Окно авторизации --- */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-card {
    background: rgb(30 30 30 / 65%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(14px);
    padding: 40px 30px;
    border-radius: 16px;
    width: 380px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.login-card .logo-supido {
    margin-bottom: 25px;
    font-size: 50px;
}

.login-card .edit-input {
    margin-bottom: 15px;
    text-align: center;
    font-size: 15px;
    padding: 10px;
}

.login-error {
    color: #ff5555;
    font-size: 13px;
    margin-top: 10px;
    min-height: 18px;
    font-weight: 500;
}

/* --- МОБИЛЬНЫЕ СТИЛИ --- */
.mobile-cat-header {
    display: none;
}

@media (max-width: 980px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        justify-content: flex-start;
    }

    .sidebar-top {
        max-height: none;
        gap: 15px;
    }

    .desktop-bottom {
        display: none !important;
    }

    .mobile-top-buttons {
        display: none !important;
    }

    .sidebar-top.menu-open .mobile-top-buttons {
        display: flex !important;
    }

    .mobile-top-buttons button {
        flex: 1;
        font-size: 11px;
        padding: 8px 4px;
        text-align: center;
    }

    .mobile-cat-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.2);
        padding: 12px 16px;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
        color: #fff;
        transition: background 0.2s;
    }

    .mobile-cat-header:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .categories-list {
        display: none;
        flex-direction: column;
        gap: 6px;
        margin-top: 8px;
        background: rgba(20, 20, 20, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
        position: relative;
        z-index: 50;
    }

    .categories-list.open {
        display: flex;
    }

    .main-content {
        padding: 20px;
    }
}