:root {
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --text-color: #fff;
    --item-bg: rgba(255, 255, 255, 0.15);
    --item-hover: rgba(255, 255, 255, 0.3);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    color: var(--text-color);
}

#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: -2;
    transition: background-image 0.5s ease;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: -1;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    backdrop-filter: blur(10px);
}

.time-widget {
    font-size: 24px;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.right button, .right a {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    margin-left: 10px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.right button:hover, .right a:hover {
    background: rgba(255,255,255,0.4);
}

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

/* Search */
.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 60px;
    position: relative;
}

/* New Search Tabs */
.search-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.search-tab {
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s;
    border-radius: 20px;
    background: rgba(0,0,0,0.2);
}

.search-tab:hover {
    color: white;
    background: rgba(0,0,0,0.4);
}

.search-tab.active {
    color: #333;
    background: rgba(255,255,255,0.9);
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#search-form {
    width: 600px;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    pointer-events: none;
}

#search-input {
    width: 100%;
    height: 50px;
    padding: 0 20px 0 50px;
    border-radius: 25px;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    outline: none;
    box-sizing: border-box;
    transition: background 0.3s;
}
#search-input:focus {
    background: rgba(255, 255, 255, 0.35);
}
#search-input::placeholder { color: rgba(255,255,255,0.7); }

/* Nav Grid (Updated with Box Style) */
.category-section {
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.15);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.category-title {
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    color: rgba(255, 255, 255, 0.95);
}

.cat-actions {
    display: none; /* Hidden by default */
}

/* Only show cat-actions in edit mode */
.edit-mode .cat-actions {
    display: flex !important;
    gap: 10px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
    position: relative;
    padding: 15px;
    border-radius: 16px;
    transition: background 0.2s;
}

.nav-item:hover {
    background: var(--item-bg);
    backdrop-filter: blur(5px);
}

.nav-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 10px;
    background: white;
    padding: 8px;
    box-sizing: border-box;
    object-fit: contain;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.nav-title {
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.item-actions {
    display: none;
}

/* Edit Mode States */
.edit-mode .item-actions, .edit-mode .add-link-btn {
    display: flex !important;
}

/* Edit Actions on Link Item */
.item-actions-container {
    position: absolute;
    top: -8px;
    right: -8px;
    display: none; /* Show in edit mode */
    gap: 5px;
}

.edit-mode .item-actions-container {
    display: flex !important;
}

.action-bubble {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.action-bubble:hover {
    transform: scale(1.1);
}

.btn-edit-bubble {
    background: #007AFF;
}

.btn-delete-bubble {
    background: #ff3b30;
}

.add-link-btn {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 16px;
    min-height: 90px;
}
.add-link-btn:hover { background: rgba(255,255,255,0.1); }

.hidden { display: none !important; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.85);
    margin: 10% auto;
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 24px;
    color: #333;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    max-width: 400px; /* Default small size */
}

/* Confirmation Modal */
.confirm-modal-content {
    width: 320px;
    text-align: center;
    padding: 30px;
}

.confirm-icon {
    font-size: 48px;
    color: #ff9500;
    margin-bottom: 20px;
}

#confirm-message {
    margin-bottom: 30px;
    color: #666;
    font-size: 15px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-actions button {
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
}

.btn-danger {
    background: #ff3b30;
    color: white;
}
.btn-danger:hover {
    background: #d32f2f;
}

.wallpaper-modal-content {
    width: 600px;
    max-width: 90%;
}

.auth-modal-content {
    width: 360px;
    max-width: 90%;
    padding: 40px;
}

.admin-modal-content {
    width: 800px;
    max-width: 95%;
    margin-top: 5%;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

/* Wallpaper Grid */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.wallpaper-item {
    height: 100px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform 0.2s, border 0.2s;
    border: 2px solid transparent;
}

.wallpaper-item:hover {
    transform: scale(1.05);
}

.wallpaper-item.selected {
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0,122,255,0.3);
}

.custom-wallpaper-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.custom-wallpaper-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.custom-wallpaper-input button {
    background: #007AFF;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.cancel-btn {
    background: transparent;
    border: 1px solid #ccc;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
}

/* Auth Modal Styles */
.input-group {
    margin-bottom: 15px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    background: white;
    outline: none;
    box-sizing: border-box;
    font-size: 16px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #007AFF;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}
.btn-primary:hover { background: #0056b3; }

.auth-switch {
    margin-top: 20px;
    font-size: 14px;
    color: #007AFF;
    cursor: pointer;
}

.close-icon-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}
.close-icon-btn:hover { color: #333; }

.add-category-btn {
    text-align: center;
    padding: 20px;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 12px;
    cursor: pointer;
    margin-top: 20px;
}
.add-category-btn:hover { background: rgba(255,255,255,0.1); }

/* Admin Table Styles */
.admin-table-wrapper {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 10px;
}

.user-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}
.user-table th {
    text-align: left;
    padding: 15px;
    color: #666;
    font-weight: 500;
    font-size: 14px;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.9);
    z-index: 10;
}
.user-table td {
    background: white;
    padding: 15px;
    font-size: 15px;
    vertical-align: middle;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.user-table tr td:first-child { border-left: 1px solid #f0f0f0; border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.user-table tr td:last-child { border-right: 1px solid #f0f0f0; border-top-right-radius: 12px; border-bottom-right-radius: 12px; }

.user-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.role-admin { background: #E5F0FF; color: #007AFF; }
.role-user { background: #F0F2F5; color: #666; }

.action-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    color: #666;
}
.action-btn:hover { background: #f5f5f5; color: #333; }
.btn-delete { color: #ff3b30; }
.btn-delete:hover { background: #fff0f0; color: #d32f2f; }

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
}

/* Add Link Modal Specifics */
.icon-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    text-align: left;
}

.icon-type-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.icon-type-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border: 1px solid #ddd;
    color: #666;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.icon-type-btn.active {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
    box-shadow: 0 2px 8px rgba(0,122,255,0.3);
}

.system-icons-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    max-height: 180px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(245,245,245,0.5);
    border-radius: 12px;
    border: 1px solid #eee;
}

.sys-icon-item {
    width: 100%;
    aspect-ratio: 1;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sys-icon-item:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.sys-icon-item.selected {
    border-color: #007AFF;
    background: #E5F0FF;
}

.sys-icon-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Merged Styles --- */

/* From style_icons.css */
.icon-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.icon-type-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.icon-type-btn {
    flex: 1;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-type-btn.active {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

.system-icons-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding: 5px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

.sys-icon-item {
    width: 40px;
    height: 40px;
    padding: 5px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.sys-icon-item:hover {
    background: rgba(0,0,0,0.1);
}

.sys-icon-item.selected {
    border-color: #007AFF;
    background: rgba(0,122,255,0.1);
}

.sys-icon-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* From style_cat_actions.css */
.cat-actions button {
    transition: transform 0.2s;
}

.cat-actions button:hover {
    transform: scale(1.1);
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    .top-bar {
        padding: 15px 20px;
    }
    
    .time-widget {
        font-size: 18px;
    }
    
    #search-form {
        width: 90%;
        max-width: 600px;
    }
    
    .search-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .wallpaper-modal-content,
    .admin-modal-content {
        width: 95%;
        margin: 20% auto;
    }
    
    .wallpaper-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .right button, .right a {
        padding: 6px 12px;
        font-size: 12px;
    }
}

