:root {
    --bg-color: #0f0a1e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --primary-color: #9d4edd;
    --primary-hover: #7b2cbf;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent-color: #c77dff;
    --danger-color: #ff4d4d;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(157, 78, 221, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(199, 125, 255, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    gap: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab {
    padding: 0.6rem 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    color: var(--text-muted);
}

.tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.3);
}

.tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

/* Grid */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.link-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.link-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.link-card img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
}

.link-card span {
    font-weight: 500;
    font-size: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a142e;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary-color);
}

button {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    margin-top: 0.5rem;
}

.input-with-loader {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-loader .spinner {
    position: absolute;
    right: 12px;
    margin: 0;
}

.input-with-loader input {
    padding-right: 40px;
}

/* Admin icons */
.admin-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.link-card:hover .admin-actions {
    opacity: 1;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    text-decoration: none;
}

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

.icon-btn.delete:hover {
    background: var(--danger-color);
}

/* Drag & Drop */
.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary-color);
}

/* Autocomplete chips */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.chip {
    background: rgba(157, 78, 221, 0.2);
    border: 1px solid var(--primary-color);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chip .close {
    cursor: pointer;
    font-weight: bold;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden { display: none; }

.cat-manage-item {
    display: inline-flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.cat-manage-item .tab {
    border: none;
    border-radius: 0;
    background: transparent;
    margin: 0;
}

.cat-manage-item .tab.active {
    background: var(--primary-color);
}

.cat-manage-item .delete-btn {
    padding: 0 0.8rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 77, 77, 0.1);
    color: var(--danger-color);
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.cat-manage-item .delete-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* Search Modal */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 10, 30, 0.98);
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 2000;
    padding: 10vh 2rem 2rem;
    backdrop-filter: blur(20px);
}

.search-modal.active {
    display: flex;
}

.search-input-container {
    width: 100%;
    max-width: 800px;
    margin-bottom: 2rem;
    position: relative;
}

.search-input-container input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    font-size: 1.5rem;
    color: white;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input-container input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 30px rgba(157, 78, 221, 0.2);
}

.search-results {
    width: 100%;
    max-width: 800px;
    overflow-y: auto;
    flex-grow: 1;
}

.search-hint {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-hint kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    position: absolute;
    top: 5rem;
    right: 2rem;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 200px;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu-item {
    padding: 0.8rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s;
    font-size: 1rem;
}

.mobile-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none !important;
    }
    .mobile-nav-toggle {
        display: block !important;
    }
}
