@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #0b132b 0%, #1c2541 40%, #002b49 70%, #005073 100%);
    background-attachment: fixed;
    color: #f1f5f9;
    min-height: 100vh;
    overflow-x: hidden;
}

/* NAVBAR */
.navbar {
    background: rgba(11, 19, 43, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 8px;
    transition: 0.2s all;
}

nav a:hover, nav a.active {
    color: #00f2fe;
    background: rgba(0, 242, 254, 0.1);
}

.anime-link {
    color: #ff758c !important;
    font-weight: 500;
}

/* CONTAINER */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* CARDS */
.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* DROPZONE */
.dropzone {
    border: 2px dashed rgba(0, 242, 254, 0.4);
    border-radius: 16px;
    padding: 25px 15px;
    text-align: center;
    background: rgba(0, 242, 254, 0.03);
    cursor: pointer;
    transition: 0.3s all;
    margin-bottom: 20px;
}
.dropzone.dragover {
    border-color: #00f2fe;
    background: rgba(0, 242, 254, 0.15);
    transform: scale(1.01);
}
.dropzone-icon {
    font-size: 32px;
    margin-bottom: 6px;
}

/* GRID LAYOUT */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.item-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: 0.25s transform, 0.25s box-shadow;
}

.folder-card {
    cursor: pointer;
    align-items: center;
    text-align: center;
    padding: 18px 12px;
}
.folder-card.drag-target {
    border: 2px dashed #00f2fe !important;
    background: rgba(0, 242, 254, 0.2) !important;
    transform: scale(1.03);
}

.item-icon {
    font-size: 42px;
    margin-bottom: 6px;
}

/* MEDIA PREVIEWS */
.media-preview {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.media-preview img, .media-preview .video-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 242, 254, 0.85);
    color: #0b132b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
    pointer-events: none;
    transition: 0.2s transform;
}

.media-preview:hover .video-play-overlay {
    transform: translate(-50%, -50%) scale(1.15);
}

.media-preview audio {
    width: 100%;
    margin: 15px 5px;
}

.item-name {
    font-weight: 500;
    margin: 10px 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.item-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 8px;
}

/* BUTTONS & FORMS */
.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #0b132b;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    transition: 0.2s opacity;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
}
.btn-success { background: #10b981; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 500;
}
.badge-public { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-private { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.styled-table-wrap {
    width: 100%;
    overflow-x: auto;
}
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    min-width: 500px;
}
.styled-table th, .styled-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.form-group { margin-bottom: 12px; }
input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px;
    color: #fff;
    font-size: 1rem;
    outline: none;
}
input:focus, textarea:focus {
    border-color: #00f2fe;
}

/* ========================================================== */
/* MODAL MEDIA VIEWER (LIGHTBOX)                              */
/* ========================================================== */
.modal-viewer {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 10, 24, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 15px;
}

.viewer-header {
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10001;
}

.viewer-title {
    font-size: 1rem;
    font-weight: 500;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.viewer-actions {
    display: flex;
    gap: 12px;
}

.viewer-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: 0.2s all;
}
.viewer-btn:active {
    transform: scale(0.92);
    background: rgba(0, 242, 254, 0.4);
}

.viewer-content {
    max-width: 95vw;
    max-height: 82vh; /* Вертикальный увеличенный размер на экране */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 40px;
}

.viewer-content img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.viewer-content video {
    max-width: 100%;
    max-height: 82vh;
    border-radius: 14px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    outline: none;
}

/* ========================================================== */
/* MOBILE ADAPTATION (≤ 768px)                                */
/* ========================================================== */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 15px;
    }
    .brand {
        font-size: 1.15rem;
    }
    nav {
        width: 100%;
        justify-content: space-between;
        gap: 4px;
        margin-top: 4px;
    }
    nav a {
        font-size: 0.8rem;
        padding: 5px 7px;
    }
    .container {
        margin: 12px auto;
        padding: 0 10px;
    }
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .item-card {
        padding: 8px;
    }
    .media-preview img, .media-preview .video-thumbnail {
        height: 130px;
    }
    .video-play-overlay {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .item-icon {
        font-size: 36px;
    }
    .item-name {
        font-size: 0.85rem;
    }
    .item-meta {
        font-size: 0.7rem;
    }
    .dropzone {
        padding: 18px 10px;
    }
    .dropzone-icon {
        font-size: 26px;
    }
    .card form {
        flex-direction: column;
        align-items: stretch !important;
    }
    .card form input[type="text"] {
        max-width: 100% !important;
    }
    
    .viewer-content {
        max-width: 100vw;
        max-height: 78vh; /* Удобный вертикальный размер для смартфона */
        margin-top: 50px;
    }
    .viewer-content video, .viewer-content img {
        max-height: 78vh;
    }
}

@media (max-width: 380px) {
    .grid {
        grid-template-columns: 1fr;
    }
}