:root {
    --bg-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-color: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-kahoot: #46178f;
    --accent-fiemg: #0056b3;
    --accent-excel: #1d6f42;
    --accent-people: #e11d48;
    --accent-docente: #0891b2;
    --accent-classroom: #16a34a;
    --accent-prezi: #313391;
    /* Generic colors for custom links */
    --accent-generic-1: #eab308;
    --accent-generic-2: #a855f7;
    --accent-generic-3: #ec4899;
    --accent-generic-4: #06b6d4;
    --hover-glow: rgba(255, 255, 255, 0.2);
    --modal-bg: #1e293b;
    --input-bg: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    padding: 2rem;
    overflow-x: hidden;
}

/* Header / Clock Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: fadeInDown 1s ease-out;
    width: 100%;
    max-width: 1200px;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle separator */
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

h1 {
    font-weight: 600;
    font-size: 2rem;
    /* Slightly smaller for compact header */
    margin-bottom: 0;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    /* Cleaner look */
}

#clock {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-align: left;
}

/* Top Bar: Auth & Status */
.top-bar {
    position: static;
    /* No longer absolute */
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    /* Allow search to wrap on small screens */
}

/* Search Box Styles */
.search-container {
    position: relative;
    margin-right: 1rem;
}

.search-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 0.4rem 1rem 0.4rem 2.2rem;
    color: #fff;
    width: 200px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    width: 250px;
    /* Expand on focus */
    border-color: rgba(255, 255, 255, 0.3);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.8rem;
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.search-clear-btn:hover {
    color: #ef4444;
}

@media (max-width: 600px) {
    .search-input {
        width: 100%;
    }

    .search-input:focus {
        width: 100%;
    }

    .search-container {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
        order: -1;
        /* search first on mobile? or last? let's stick to flex order */
    }
}

/* Auth Button */
#auth-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

#auth-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Grid Layout */
.dashboard-grid,
.group-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1200px;
    animation: fadeInUp 1s ease-out 0.3s backwards;
}

/* Card Styles */
.link-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    height: 250px;
    cursor: pointer;
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: translateX(-100%);
    transition: 0.6s;
}

.link-card:hover::before {
    transform: translateX(100%);
}

.link-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.icon-container {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.link-card:hover .icon-container {
    transform: scale(1.1) rotate(5deg);
}

.card-title {
    font-weight: 600;
    font-size: 1.25rem;
    text-align: center;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Action Buttons (Edit/Delete) - HIDDEN BY DEFAULT */
.card-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: none;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Only shown if logged in */
}

/* ... existing button styles ... */

.link-card:hover .card-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.delete-btn:hover {
    background: #ef4444;
}

.edit-btn:hover {
    background: #3b82f6;
}

/* Add New Card - HIDDEN BY DEFAULT */
.add-card {
    border: 2px dashed var(--card-border);
    background: rgba(255, 255, 255, 0.02);
    display: none;
    /* Only shown if logged in */
}

.add-card:hover {
    border-color: var(--text-secondary);
}

.add-card .icon-container {
    background: transparent;
    color: var(--text-secondary);
}

/* Logged In State for Grid AND Group Content */
.dashboard-grid.logged-in .card-actions,
.group-content.logged-in .card-actions {
    display: flex !important;
    opacity: 0;
}

/* Keep hover opacity logic */
.dashboard-grid.logged-in .link-card:hover .card-actions,
.group-content.logged-in .link-card:hover .card-actions {
    opacity: 1;
}

.dashboard-grid.logged-in .add-card,
.group-content.logged-in .add-card {
    display: flex !important;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--modal-bg);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: #fff;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}

/* Specific Colors for Default Cards */
.color-kahoot .icon-container {
    background: transparent;
    color: var(--text-color);
}

.link-card.color-kahoot:hover .icon-container {
    background: var(--accent-kahoot);
    color: white;
    box-shadow: 0 0 20px var(--accent-kahoot);
}

.link-card.color-fiemg:hover .icon-container {
    background: var(--accent-fiemg);
    color: white;
    box-shadow: 0 0 20px var(--accent-fiemg);
}

.link-card.color-excel:hover .icon-container {
    background: var(--accent-excel);
    color: white;
    box-shadow: 0 0 20px var(--accent-excel);
}

.link-card.color-pessoas:hover .icon-container {
    background: var(--accent-people);
    color: white;
    box-shadow: 0 0 20px var(--accent-people);
}

.link-card.color-docente:hover .icon-container {
    background: var(--accent-docente);
    color: white;
    box-shadow: 0 0 20px var(--accent-docente);
}

.link-card.color-classroom:hover .icon-container {
    background: var(--accent-classroom);
    color: white;
    box-shadow: 0 0 20px var(--accent-classroom);
}

.link-card.color-prezi:hover .icon-container {
    background: var(--accent-prezi);
    color: white;
    box-shadow: 0 0 20px var(--accent-prezi);
}

/* General Colors */
.color-generic:hover .icon-container {
    background: var(--accent-generic-4);
    color: white;
    box-shadow: 0 0 20px var(--accent-generic-4);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .header-left {
        align-items: center;
    }

    #clock {
        text-align: center;
    }

    .top-bar {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Icon Grid */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.icon-option:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.icon-option.selected {
    background: #3b82f6;
    color: white;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Scrollbar for icon grid */
.icon-grid::-webkit-scrollbar {
    width: 6px;
}

.icon-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Drag and Drop Styles */
.link-card.dragging {
    opacity: 0.5;
    cursor: move;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.02);
}

.link-card.drag-over {
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

/* Size Variants - GRID */
/* Specificity increased with :not(.list-view) so they don't break list view */

.dashboard-grid:not(.list-view).size-small,
.group-content:not(.list-view).size-small {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.dashboard-grid:not(.list-view).size-small .link-card,
.group-content:not(.list-view).size-small .link-card {
    padding: 0.75rem;
    height: 130px;
}

.dashboard-grid:not(.list-view).size-small .icon-container,
.group-content:not(.list-view).size-small .icon-container {
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.dashboard-grid:not(.list-view).size-small .card-title,
.group-content:not(.list-view).size-small .card-title {
    font-size: 0.9rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.dashboard-grid:not(.list-view).size-small .card-desc,
.group-content:not(.list-view).size-small .card-desc {
    font-size: 0.7rem;
    display: block;
    opacity: 0.7;
    line-height: 1.1;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Desktop Override for Small Size */
@media (min-width: 768px) {

    .dashboard-grid:not(.list-view).size-small,
    .group-content:not(.list-view).size-small {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .dashboard-grid:not(.list-view).size-small .link-card,
    .group-content:not(.list-view).size-small .link-card {
        height: 180px;
        padding: 1rem;
    }

    .dashboard-grid:not(.list-view).size-small .icon-container,
    .group-content:not(.list-view).size-small .icon-container {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }

    .dashboard-grid:not(.list-view).size-small .card-title,
    .group-content:not(.list-view).size-small .card-title {
        font-size: 1rem;
    }
}

.dashboard-grid:not(.list-view).size-medium,
.group-content:not(.list-view).size-medium {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.dashboard-grid:not(.list-view).size-medium .link-card,
.group-content:not(.list-view).size-medium .link-card {
    height: 220px;
    padding: 1.5rem;
}

.dashboard-grid:not(.list-view).size-medium .icon-container,
.group-content:not(.list-view).size-medium .icon-container {
    width: 65px;
    height: 65px;
    font-size: 2.5rem;
}




/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--modal-bg);
    min-width: 200px;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
    z-index: 1;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    overflow: hidden;
    top: 110%;
}

.dropdown-content button {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.dropdown-content button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-content button.danger {
    color: #fca5a5;
}

.dropdown-content button.danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

.dropdown-content.show {
    display: block;
    animation: fadeInDown 0.2s ease-out;
}

/* Loading Spinner for buttons */
.loading-sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* TOGGLE SWITCH STYLES */
.view-toggle {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
    margin-right: 0.5rem;
    flex-shrink: 0;
    vertical-align: middle;
}

.view-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--card-border);
}

/* The Knob (Background highlight) */
.slider-knob {
    position: absolute;
    height: 22px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    /* Centered vertically (28-22)/2 */
    background-color: #fff;
    transition: .4s;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Active State (List) - Move Knob */
input:checked+.slider {
    background-color: rgba(255, 255, 255, 0.15);
    /* Slightly lighter background */
    border-color: rgba(255, 255, 255, 0.3);
}

input:checked+.slider .slider-knob {
    transform: translateX(26px);
    /* 56 - 3 - 3 - 24 = 26 */
}

/* Icon Container (Overlay) */
.slider-icons {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    z-index: 2;
    /* Above knob */
    pointer-events: none;
    /* Click goes to checkbox */
}

/* Icons */
.slider-icons i {
    font-size: 0.8rem;
    color: var(--text-secondary);
    /* Default Dim */
    transition: color 0.3s;
    width: 14px;
    text-align: center;
    line-height: 1;
}

/* Highlight Grid Icon when Unchecked */
input:not(:checked)+.slider .slider-icons .fa-border-all {
    color: #3b82f6;
}


/* Note: Original file had 949 lines ending here */
/* Highlight List Icon when Checked */
input:checked+.slider .slider-icons .fa-list {
    color: #3b82f6;
}

/* ---- Extracted Inline Styles ---- */

/* Restricted Toolbar */
#restricted-toolbar {
    display: none;
    /* Initially hidden */
    align-items: center;
    gap: 1rem;
}

.size-controls {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.size-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 8px;
    font-size: 0.8rem;
    transition: color 0.2s;
}

/* Tools Dropdown Button */
.tools-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
}

.tools-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Elements */
.icon-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

#selectedIconPreview {
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    flex-shrink: 0;
}

.more-icons-link {
    margin-top: 5px;
    font-size: 0.8rem;
    color: #64748b;
    text-align: right;
}


/* Mobile Improvements */
@media (max-width: 1024px) {

    /* Only apply these layout fixes when logged in to reorganize the toolbar */
    body.logged-in .top-bar {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        width: 100%;
    }

    body.logged-in #restricted-toolbar {
        display: contents !important;
        /* Unwrap to let children participate in top-bar grid/flex */
    }

    body.logged-in .search-container {
        flex: 1 1 100% !important;
        /* Force full width explicitly */
        width: 100% !important;
        margin: 0 !important;
        order: 1;
        /* Search on top */
    }

    body.logged-in .search-input,
    body.logged-in .search-input:focus {
        width: 100% !important;
    }

    body.logged-in #add-link-btn {
        order: 2;
        /* Add button next */
        flex: 0 0 auto;
        margin: 0 !important;
    }

    body.logged-in .user-menu-container {
        order: 3;
        /* User menu next */
        flex: 0 0 auto;
        margin: 0 !important;
    }

    /* Fallback/Default Mobile Styles for non-logged states or unrelated elements */
    /* .view-toggle removal reverted to show it in dropdown */
}

.more-icons-link a {
    color: #3b82f6;
    text-decoration: none;
}

.more-icons-link a:hover {
    text-decoration: underline;
}

/* ---- GROUP STYLES ---- */
.group-container {
    width: 100%;
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease-out backwards;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.group-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-title i {
    color: var(--text-secondary);
    font-size: 1rem;
}

.group-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
}

.group-controls {
    display: flex;
    gap: 0.5rem;
}

.group-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.group-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.group-drag-over {
    border: 2px dashed #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
}

/* ---- LAYOUT OVERRIDES ---- */
/* Main container for groups should NOT be a grid, but a vertical column */
#card-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    animation: fadeInUp 1s ease-out 0.3s backwards;
}

.group-container {
    width: 100%;
}

/* Explicit Grid for Group Content */
.group-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

/* Force Size overrides with !important to beat any media queries */
.group-content.size-small,
.dashboard-grid.size-small {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 0.75rem !important;
}

.group-content.size-medium,
.dashboard-grid.size-medium {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 1.25rem !important;
}

/* Mobile Responsiveness for Grid */
@media (max-width: 600px) {
    .group-container {
        width: 100%;
        padding: 0;
    }

    .group-content {
        display: grid;
        width: 100%;
    }

    .group-content.size-small:not(.list-view) {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .group-content.size-small:not(.list-view) .link-card {
        height: auto !important;
        aspect-ratio: 1/1;
        padding: 0.5rem !important;
    }

    .group-content.size-medium {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .group-content.size-large {
        grid-template-columns: 1fr !important;
    }
}

/* User Menu Styles - Refined */
.user-menu-container {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

.user-avatar-btn {
    background: rgba(255, 255, 255, 0.05);
    /* Slight tint */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.4rem 0.8rem 0.4rem 0.6rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.user-avatar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.user-avatar-btn img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    /* More spacing */
    background: rgba(15, 23, 42, 0.95);
    /* Dark background (slate-900) */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 240px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    z-index: 1000;
    padding: 12px;
    transform-origin: top right;
    animation: scaleIn 0.2s ease-out;
}

.user-dropdown-content.show {
    display: block;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-section {
    margin-bottom: 8px;
}

.dropdown-section h4 {
    margin: 4px 12px 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    /* ensure it's gray not white */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Menu Rows */
.menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    margin-bottom: 8px;
}

/* Specific fix for Size Controls inside menu */
.user-dropdown-content .size-controls {
    background: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 8px;
    display: flex;
    gap: 2px;
}

.user-dropdown-content .size-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.user-dropdown-content .size-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Menu Buttons (Full Width) */
.menu-item-btn {
    width: 100%;
    text-align: left;
    background: transparent !important;
    /* Force transparent */
    border: none;
    color: var(--text-color);
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 400;
}

.menu-item-btn i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.menu-item-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(4px);
    color: #fff;
}

.menu-item-btn:hover i {
    color: #fff;
}

.menu-item-btn.danger {
    color: #ef4444 !important;
}

.menu-item-btn.danger i {
    color: #ef4444;
}

.menu-item-btn.danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
}

.menu-item-btn.danger:hover i {
    color: #fca5a5;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* Group Control Buttons (Rename/Sort) */
.group-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 5px;
}

.group-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ---- LIST VIEW STYLES (FINAL FORCE) ---- */
.dashboard-grid.list-view,
.group-content.list-view {
    display: flex !important;
    flex-direction: column !important;
    max-width: 900px;
    margin: 0 auto;
}

.dashboard-grid.list-view .link-card,
.group-content.list-view .link-card {
    padding: 0.4rem 0.8rem !important;
    /* Extremely compact */
    min-height: 44px !important;
    height: auto !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.8rem !important;
}

.dashboard-grid.list-view .icon-container,
.group-content.list-view .icon-container {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.1rem !important;
    margin: 0 !important;
    background: var(--card-bg-hover);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important;
}

.dashboard-grid.list-view .card-title,
.group-content.list-view .card-title {
    font-size: 0.95rem !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex-grow: 1;
    text-align: left !important;
}

.dashboard-grid.list-view .card-desc,
.group-content.list-view .card-desc {
    font-size: 0.75rem !important;
    max-width: 40% !important;
    text-align: right !important;
    margin: 0 !important;
    opacity: 0.7;
    display: block !important;
    /* Ensure visible unless mobile hides it */
}

/* Mobile specific list view adjustments */
@media (max-width: 768px) {

    .dashboard-grid.list-view .card-desc,
    .group-content.list-view .card-desc {
        display: none !important;
    }
}

/* Specific Styles for Aiken Converter */
.converter-container {
    width: 100%;
    max-width: 900px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.5s ease-out;
    margin-top: 2rem;
}

.converter-header {
    text-align: center;
    margin-bottom: 2rem;
}

.converter-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.converter-header p {
    color: var(--text-secondary);
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.drop-zone {
    border: 2px dashed var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.drop-zone i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.drop-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.manual-input {
    width: 100%;
    height: 200px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    color: #fff;
    font-family: monospace;
    resize: vertical;
}

.manual-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-convert {
    background: #3b82f6;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-convert:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back:hover {
    border-color: #fff;
    color: #fff;
}

/* Preview Table */
.preview-section {
    margin-top: 2rem;
    display: none;
    animation: fadeInDown 0.5s ease-out;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
}

th {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

td {
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: #fff;
}

.status-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-success {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

@media (max-width: 768px) {
    .converter-container {
        padding: 1.5rem;
    }

    .actions {
        flex-direction: column;
    }

    .btn-convert,
    .btn-back {
        width: 100%;
        justify-content: center;
    }
}

/* Export Dropdown */
.export-dropdown-container {
    position: relative;
    display: inline-block;
}

.export-toggle {
    background-color: #3b82f6;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.export-toggle:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.export-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;

    background-color: #1e293b;
    /* Enforce Solid Dark Color */
    min-width: 240px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    flex-direction: column;
}

.export-dropdown-content.show {
    display: flex;
    animation: fadeInDown 0.2s ease;
}

.dropdown-item {
    background: none;
    color: #ffffff;
    color: var(--text-primary, #ffffff);
    padding: 14px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    text-align: left;
    border: none;
    width: 100%;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
    font-family: 'Outfit', sans-serif;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    background-color: var(--bg-secondary, rgba(255, 255, 255, 0.05));
}

.dropdown-item i {
    width: 25px;
    text-align: center;
    margin-right: 12px;
    font-size: 1.1rem;
}

/* Specific item colors icons */
#generateScriptBtn i {
    color: #8b5cf6;
}

#generateAddonBtn i {
    color: #f97316;
}

#downloadBtn i {
    color: #22c55e;
}

/* Refactoring Utilities for Aiken HTML */
.mt-small {
    margin-top: 10px;
}

#persistentAddonBtn {
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
    border-color: rgba(255, 255, 255, 0.2);
}

.modal-content-lg {
    max-width: 800px;
    width: 90%;
}

#modalInstructions {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.link-highlight,
.link-highlight:visited {
    color: #60a5fa;
    /* Brighter blue */
    text-decoration: none;
    font-weight: 600;
}

.link-highlight:hover {
    color: #93c5fd;
    /* Even lighter on hover */
    text-decoration: underline;
}

.script-output-area {
    height: 300px !important;
    /* Force height */
    font-size: 0.85rem !important;
}