:root {
    --bg-color: #0f0f1a;
    --primary: #ff0055;
    --secondary: #00e5ff;
    --accent: #ffee00;
    --text-color: #e0e0e0;
    --card-bg: #1a1a2e;
}

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

body {
    font-family: 'VT323', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Grid Background */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 0;
    pointer-events: none;
}

/* Scanline Effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.1) 50%,
        rgba(0,0,0,0.1)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1000;
}

.main-layout {
    display: flex;
    min-height: calc(100vh - 40px);
    gap: 20px;
}

.sidebar {
    width: 280px;
    background-color: var(--card-bg);
    border: 3px solid var(--text-color);
    box-shadow: 6px 6px 0px #000;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--secondary);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 5px;
}

.sidebar-btn {
    display: block;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--text-color);
    color: var(--text-color);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    margin-bottom: 8px;
    text-align: center;
    transition: all 0.2s;
}

.sidebar-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    background-color: rgba(255, 0, 85, 0.3);
    border-color: var(--primary);
}

.sidebar-btn.logout-btn {
    background-color: rgba(255, 0, 85, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 48px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 4px 4px 0px #000;
    letter-spacing: -2px;
    display: inline-block;
    margin-bottom: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: var(--secondary);
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--text-color);
    color: var(--text-color);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    transition: all 0.2s;
}

.logout-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    background-color: rgba(255, 0, 85, 0.3);
    border-color: var(--primary);
}

.register-btn {
    background-color: rgba(0, 229, 255, 0.2);
    border: 2px solid var(--secondary);
    color: var(--secondary);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    transition: all 0.2s;
    margin-right: 10px;
}

.register-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    background-color: rgba(0, 229, 255, 0.4);
    border-color: var(--accent);
    color: var(--accent);
}

.users-btn {
    background-color: rgba(255, 238, 0, 0.2);
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    transition: all 0.2s;
    margin-right: 10px;
}

.users-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    background-color: rgba(255, 238, 0, 0.4);
    border-color: var(--secondary);
    color: var(--secondary);
}

.import-container {
    position: relative;
    display: block;
}

.import-container label {
    display: block !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid var(--text-color) !important;
    color: var(--text-color) !important;
    padding: 8px 15px !important;
    font-family: 'Press Start 2P', cursive !important;
    font-size: 10px !important;
    cursor: pointer !important;
    box-shadow: 4px 4px 0px #000 !important;
    text-decoration: none !important;
    margin-bottom: 8px !important;
    text-align: center !important;
    transition: all 0.2s !important;
    width: 100% !important;
}

.import-container label:hover {
    transform: translate(-2px, -2px) !important;
    box-shadow: 6px 6px 0px #000 !important;
    background-color: rgba(255, 0, 85, 0.3) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.all-bookmarks-btn {
    background-color: rgba(255, 0, 85, 0.2);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    transition: all 0.2s;
    margin-right: 10px;
}

.all-bookmarks-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    background-color: rgba(255, 0, 85, 0.4);
    border-color: var(--accent);
    color: var(--accent);
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 20px;
    position: relative;
}

.search-and-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    background-color: var(--card-bg);
    border: 3px solid var(--text-color);
    color: var(--text-color);
    font-family: 'VT323', monospace;
    font-size: 16px;
    box-shadow: 4px 4px 0px #000;
    outline: none;
}

.search-input:focus {
    border-color: var(--secondary);
    box-shadow: 6px 6px 0px #000;
}

/* Categories Navigation */
.categories-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    gap: 10px;
}

.category-btn {
    background-color: var(--card-bg);
    border: 3px solid var(--text-color);
    color: var(--text-color);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.category-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    border-color: var(--secondary);
}

.category-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.category-btn[data-color] {
    position: relative;
}

.category-color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid var(--text-color);
}

.add-category-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--text-color);
}

.add-category-input {
    flex: 1;
    padding: 8px;
    background-color: #0f0f1a;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    outline: none;
}

.add-category-btn {
    background-color: var(--secondary);
    color: #000;
    border: 2px solid var(--secondary);
    padding: 8px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000;
}

.advanced-search-toggle {
    display: block;
    width: 100%;
    margin-top: 10px;
    background-color: rgba(255, 238, 0, 0.2);
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    transition: all 0.2s;
}

.advanced-search-toggle:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    background-color: rgba(255, 238, 0, 0.4);
    border-color: var(--secondary);
    color: var(--secondary);
}

.advanced-search-toggle.compact {
    width: auto;
    padding: 12px 12px;
    margin-left: 10px;
    font-size: 16px;
    background-color: var(--card-bg);
    border: 3px solid var(--text-color);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    transition: all 0.2s;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advanced-search-toggle.compact:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
    border-color: var(--secondary);
    color: var(--secondary);
}

.advanced-search-form.compact {
    position: absolute;
    z-index: 100;
    width: fit-content;
    min-width: 300px;
}

.form-row.compact {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 10px;
}

.form-group.compact {
    flex: 1;
    margin-bottom: 0;
}

.form-label.compact {
    font-size: 10px;
    margin-bottom: 3px;
}

.form-input.compact, .form-select.compact {
    padding: 5px;
    font-size: 12px;
}

.save-btn.compact {
    padding: 8px;
    font-size: 10px;
}

#resetSearch {
    background-color: var(--secondary) !important;
    color: #000 !important;
    border-color: var(--secondary) !important;
}

#resetSearch:hover {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

/* Add Bookmark Button */
.add-bookmark-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--accent);
    border: none;
    border-radius: 50%;
    box-shadow: 4px 4px 0px #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.2s;
}

.add-bookmark-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
}

.add-bookmark-btn i {
    font-size: 30px;
    color: #000;
}

/* Bookmarks Grid */
.bookmarks-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.bookmark-card {
    background-color: var(--card-bg);
    border: 3px solid var(--text-color);
    box-shadow: 6px 6px 0px #000;
    padding: 15px;
    position: relative;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-color);
    overflow: hidden;
}

.bookmark-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0px #000;
    border-color: var(--secondary);
}

.bookmark-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--secondary);
    transition: width 0.3s;
}

.bookmark-card:hover::before {
    width: 100%;
}

.bookmark-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    image-rendering: pixelated;
}

.bookmark-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.bookmark-url {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-notes {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: #aaa;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #555;
    line-height: 1.3;
}

.bookmark-tags {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #555;
}

.tag {
    display: inline-block;
    background-color: var(--secondary);
    color: #000;
    padding: 2px 6px;
    margin: 2px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    border-radius: 3px;
}

.bookmark-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.bookmark-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex-grow: 1;
}

.bookmark-card:hover .bookmark-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
}

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

/* Modal for Adding/Editing Bookmarks */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    border: 4px solid var(--text-color);
    box-shadow: 8px 8px 0px #000;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: var(--secondary);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
}

.form-input, .form-select {
    width: 100%;
    padding: 15px;
    background-color: #0f0f1a;
    border: 3px solid var(--text-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 10px;
}

.form-input:focus {
    border-color: var(--secondary);
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

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

.form-select {
    width: 100%;
    padding: 15px;
    background-color: #0f0f1a;
    border: 3px solid var(--text-color);
    color: var(--text-color);
    font-family: 'VT323', monospace;
    font-size: 18px;
    outline: none;
}

.save-btn {
    background-color: var(--primary);
    color: #fff;
    padding: 15px 20px;
    border: none;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    width: 100%;
    margin-top: 10px;
}

.save-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    border-top: 3px solid var(--primary);
}

.footer-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .logo {
        font-size: 32px;
    }

    .bookmarks-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .header {
        flex-direction: column;
        gap: 20px;
    }
}

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

/* Message styles */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 4px;
    font-family: 'VT323', monospace;
    font-size: 16px;
    z-index: 3000;
    box-shadow: 4px 4px 0px #000;
}

.success-message {
    background-color: rgba(0, 229, 255, 0.2);
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.error-message {
    background-color: rgba(255, 0, 85, 0.2);
    border: 2px solid var(--primary);
    color: var(--primary);
}

.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    z-index: 1000;
}

.preview-popup {
    position: absolute;
    background: white;
    border: 2px solid var(--text-color);
    box-shadow: 8px 8px 0px #000;
    z-index: 2000;
    display: none;
    max-width: 300px;
    overflow: hidden;
}

.preview-content {
    width: 100%;
    height: 200px;
    border: none;
}

.Preview-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background-color: var(--card-bg);
    border: 4px solid var(--text-color);
    box-shadow: 8px 8px 0px #000;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.auth-logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 36px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 4px 4px 0px #000;
    letter-spacing: -2px;
    margin-bottom: 30px;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
}

.form-input {
    width: 100%;
    padding: 12px;
    background-color: #0f0f1a;
    border: 3px solid var(--text-color);
    color: var(--text-color);
    font-family: 'VT323', monospace;
    font-size: 18px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--secondary);
}

.auth-btn {
    background-color: var(--primary);
    color: #fff;
    padding: 15px;
    border: none;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    width: 100%;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.auth-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
}

.auth-message {
    margin-bottom: 20px;
    padding: 10px;
    font-size: 16px;
    border-radius: 3px;
    display: none;
}

.auth-message.error {
    background-color: rgba(255, 0, 85, 0.2);
    border: 2px solid var(--primary);
    display: block;
}

.auth-message.success {
    background-color: rgba(0, 229, 255, 0.2);
    border: 2px solid var(--secondary);
    display: block;
}

.back-btn {
    background-color: var(--secondary);
    color: #000;
    padding: 10px 20px;
    border: none;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
}

.back-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.users-table th, .users-table td {
    border: 2px solid var(--text-color);
    padding: 10px;
    text-align: left;
    font-family: 'VT323', monospace;
    font-size: 16px;
}

.users-table th {
    background-color: rgba(26, 26, 46, 0.8);
    color: var(--secondary);
}

.users-table tr:nth-child(even) {
    background-color: rgba(26, 26, 46, 0.4);
}

.action-btn {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 5px 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 2px 2px 0px #000;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px #000;
}

.delete-btn {
    background: #ff5555;
}