:root {
    --primary: #4285F4;
    --secondary: #34A853;
    --accent: #EA4335;
    --background: #f0f2f5;
    --text: #202124;
    --card-bg: white;
    --card-shadow: rgba(0,0,0,0.08);
    --success: #0f9d58;
    --warning: #f4b400;
    --danger: #ea4335;
    --radius: 12px;
    --transition: all 0.3s ease;
}

.dark-mode {
    --background: #121212;
    --text: #f0f0f0;
    --card-bg: #1e1e1e;
    --card-shadow: rgba(0,0,0,0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

body {
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    transition: var(--transition);
    padding-bottom: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 15px 20px;
    border-radius: 0 0 15px 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50px;
    padding: 8px 20px;
    width: 300px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 1rem;
}

.search-bar input::placeholder {
    color: rgba(255,255,255,0.7);
}

.categories {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.category-btn {
    background: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-btn:hover, .category-btn.active {
    background: var(--primary);
    color: white;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 12px var(--card-shadow);
    transition: transform 0.3s ease, background 0.3s, box-shadow 0.3s;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.card-actions button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.card-actions button:hover {
    opacity: 1;
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 150px;
}

.card.empty .card-body {
    align-items: center;
    justify-content: center;
    color: #aaa;
}

.card.empty .card-body button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.card.empty .card-body button:hover {
    background: #3367d6;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    transition: 0.2s;
    color: var(--text);
    text-decoration: none;
    cursor: grab;
    position: relative;
}

.link-item:hover {
    background: #f0f5ff;
}

.dark-mode .link-item:hover {
    background: #2a2a2a;
}

.link-item .link-actions {
    display: none;
    position: absolute;
    right: 10px;
    background: var(--card-bg);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.link-item:hover .link-actions {
    display: flex;
    gap: 5px;
}

.link-item .link-actions button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.link-item .link-actions .edit-btn {
    color: var(--primary);
}

.link-item .link-actions .delete-btn {
    color: var(--danger);
}

.link-item img {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    border-radius: 50%;
}

.link-name {
    font-weight: 500;
    flex: 1;
}

.link-item.highlight {
    animation: highlight 1.5s ease;
}

@keyframes highlight {
    0% { background-color: rgba(66, 133, 244, 0.3); }
    100% { background-color: transparent; }
}

.quick-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 3px 10px var(--card-shadow);
    cursor: pointer;
    transition: 0.3s;
    min-width: 120px;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--card-shadow);
}

.action-btn i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.ai-container {
    margin-top: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 3px 10px var(--card-shadow);
    display: none;
}

.ai-container .close-ai {
    float: right;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

iframe.ai-frame {
    width: 100%;
    height: 500px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-top: 15px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

form input, form select, form button {
    font-size: 1rem;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

form button {
    cursor: pointer;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-weight: 600;
    transition: background 0.3s;
}

form button:hover {
    background: #3367d6;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row input {
    flex: 1;
}

.url-validation {
    font-size: 0.8rem;
    color: var(--danger);
    display: none;
    margin-top: -5px;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    color: var(--text);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.error {
    background: var(--danger);
}

.notification.warning {
    background: var(--warning);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.drag-over {
    background: rgba(66, 133, 244, 0.1);
    border: 2px dashed var(--primary);
}

.sortable-ghost {
    opacity: 0.5;
}

.sortable-chosen {
    box-shadow: 0 0 15px rgba(66, 133, 244, 0.5);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .search-bar {
        width: 100%;
    }

    .categories {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .quick-actions {
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
    }

    .ai-container iframe.ai-frame {
        height: 300px;
    }

    .card-body {
        min-height: 100px;
    }

    #add-link-btn {
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .action-btn {
        min-width: 100px;
        padding: 15px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-actions {
        align-self: flex-end;
    }

    .notification {
        bottom: 20px;
        left: 20px;
        right: 20px;
    }
}