
/* Button 3 dots for cards */
.card-menu-btn {
    position: relative; /* Changed from absolute */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent; /* Changed default to transparent */
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    z-index: 2; /* Lower z-index since it's in flow */
    opacity: 0;
    margin-left: 5px; /* Spacing */
}

.apunte-card-wrapper:hover .card-menu-btn {
    opacity: 1;
}

.card-menu-btn:hover {
    background: var(--hover-bg);
    color: var(--text-main);
}

/* Favorite button adjustments */
.apunte-card-wrapper .card-favorite-btn {
    position: relative; /* Changed from absolute */
    width: 32px;
    height: 32px;
    display: flex; /* Ensure flex behavior */
    align-items: center; 
    justify-content: center;
    background: transparent;
    border: none; /* Reset if needed */
    margin-left: 5px;
    z-index: 2;
    cursor: pointer;
    color: var(--text-muted); /* Ensure default color */
    transition: all 0.2s;
    border-radius: 50%;
    overflow: visible;
}

.apunte-card-wrapper .card-favorite-btn:hover {
    color: #f1c40f;
    background: radial-gradient(circle, rgba(241, 196, 15, 0.2) 0%, rgba(241, 196, 15, 0.08) 58%, rgba(241, 196, 15, 0) 72%);
    transform: scale(1.1);
}

.apunte-card-wrapper .card-favorite-btn.active {
    color: #f1c40f;
    opacity: 1; /* Always visible if active? Usually star is visible */
}

.apunte-card-wrapper .card-favorite-btn::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 999px;
    border: 1px solid rgba(241, 196, 15, 0.44);
    transform: scale(0.86);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
    pointer-events: none;
}

.apunte-card-wrapper .card-favorite-btn:hover::after {
    transform: scale(1);
    opacity: 1;
}

.apunte-card-wrapper .card-favorite-btn.is-epic {
    animation: favoriteEpicPop 0.46s cubic-bezier(0.2, 1.2, 0.25, 1);
}

.apunte-card-wrapper .card-favorite-btn.is-epic::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: #f1c40f;
    box-shadow:
        0 -15px 0 rgba(241, 196, 15, 0.96),
        12px -9px 0 rgba(241, 196, 15, 0.9),
        15px 2px 0 rgba(241, 196, 15, 0.86),
        10px 12px 0 rgba(241, 196, 15, 0.8),
        -1px 15px 0 rgba(241, 196, 15, 0.86),
        -11px 10px 0 rgba(241, 196, 15, 0.78),
        -15px -1px 0 rgba(241, 196, 15, 0.84),
        -10px -11px 0 rgba(241, 196, 15, 0.78);
    animation: favoriteEpicBurst 0.48s ease-out forwards;
    pointer-events: none;
}

.apunte-card-wrapper .card-favorite-btn.is-epic i {
    animation: favoriteStarTwist 0.46s ease-out;
}

@keyframes favoriteEpicPop {
    0% { transform: scale(1); }
    42% { transform: scale(1.34); }
    100% { transform: scale(1); }
}

@keyframes favoriteEpicBurst {
    0% { opacity: 0.92; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.12); }
}

@keyframes favoriteStarTwist {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(-18deg) scale(1.2); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Ensure arrow has spacing */
.apunte-card-arrow {
    margin-left: 10px;
}

/* Context Menu */
.card-context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 160px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    width: auto; /* Override base styles */
}

.card-context-menu.visible {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: var(--hover-bg);
}

.context-menu-item.danger {
    color: #ef4444;
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

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

.rename-modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.rename-modal-content h3 {
    margin: 0 0 16px 0;
    color: var(--text-main);
}

.rename-modal-content input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 20px;
    outline: none;
}

.rename-modal-content input:focus {
    border-color: var(--accent-color);
}

.rename-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-cancel {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--hover-bg);
    color: var(--text-main);
}

.btn-confirm {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-confirm:hover {
    filter: brightness(1.1);
}

/* Generating Button Animation */
#generate-btn {
    position: relative;
    overflow: hidden;
    /* Ensure flex layout to center content */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#generate-btn.generating {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
    cursor: wait;
    /* Fix width jumping */
    min-width: 140px;
    animation: none !important;
}

#generate-btn.generating::before {
    animation: none !important;
    opacity: 0;
}

/* Spinner animation only for the spinner icon */
#generate-btn.generating .fa-spinner {
    animation: spin 1s linear infinite;
}

/* Hide wand when generating */
#generate-btn.generating .fa-wand-magic-sparkles {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
