/**
 * Favorites System Styles
 * Styling for bookmark/favorite buttons across all list pages
 */

/* Company Icon Link Styles */
a.company__icon,
a.company__icon.rounded-2 {
    transition: all 0.3s ease;
    cursor: pointer;
}

a.company__icon:hover,
a.company__icon.rounded-2:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

a.company__icon:active,
a.company__icon.rounded-2:active {
    transform: translateY(0);
}

/* Bookmark Button Base Styles */
.listing-card__quick-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.listing-card__quick-actions--stack {
    flex-direction: column;
    gap: 0.5rem;
}

.cv-preview-open-btn {
    background: transparent;
    border: 1px solid rgba(37, 99, 235, 0.24);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2563eb;
    font-size: 18px;
    padding: 0;
    position: relative;
    flex-shrink: 0;
}

.cv-preview-open-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.45);
    transform: translateY(-2px);
}

.cv-preview-open-btn:active {
    transform: translateY(0);
}

.cv-preview-open-btn:disabled,
.cv-preview-open-btn.is-loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.cv-preview-modal-loading,
.cv-preview-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 220px;
    padding: 2rem 1.25rem;
    text-align: center;
    color: #64748b;
}

.cv-preview-modal-error p {
    margin: 0;
    color: #b42318;
}

.bookmark__btn {
    background: transparent;
    border: 1px solid rgba(125, 128, 135, 0.2);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
    font-size: 18px;
    padding: 0;
    position: relative;
    flex-shrink: 0;
}

.bookmark__btn:hover {
    background: rgba(125, 128, 135, 0.05);
    border-color: rgba(125, 128, 135, 0.4);
    transform: translateY(-2px);
}

.bookmark__btn:active {
    transform: translateY(0);
}

.bookmark__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Favorited State (Green) - High specificity */
button.bookmark__btn.favorited,
.bookmark__btn.favorited {
    color: #28a745 !important;
    border-color: rgba(40, 167, 69, 0.5) !important;
    background: rgba(40, 167, 69, 0.12) !important;
}

button.bookmark__btn.favorited:hover,
.bookmark__btn.favorited:hover {
    background: rgba(40, 167, 69, 0.2) !important;
    border-color: #28a745 !important;
    transform: translateY(-2px) !important;
}

/* Icon Styles */
.bookmark__btn i {
    transition: all 0.3s ease;
    font-size: 18px;
}

button.bookmark__btn.favorited i,
.bookmark__btn.favorited i {
    transform: scale(1.1);
    color: #28a745 !important;
}

/* Animation on toggle */
@keyframes bookmarkPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.bookmark__btn.animating {
    animation: bookmarkPulse 0.4s ease;
}

/* Loading State */
.bookmark__btn.loading {
    pointer-events: none;
}

.bookmark__btn.loading i {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Tooltip */
.bookmark__btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.bookmark__btn[title]:hover::after {
    opacity: 1;
}

/* Responsive */
@media (max-width: 576px) {
    .bookmark__btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .bookmark__btn i {
        font-size: 16px;
    }
}

/* Grid View Specific */
.grid__style .rts__job__card > .d-flex:first-child {
    position: relative;
    min-height: 60px;
    padding-right: 52px;
}

.grid__style .bookmark__btn {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0 !important;
}

/* List View Specific */
.list__style .rts__job__card__big,
.list__style .rts__author__card__big {
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
}

.list__style .rts__job__card__big > div:first-child,
.list__style .rts__author__card__big > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.list__style .rts__job__card__big > div:last-child,
.list__style .rts__author__card__big > div:last-child {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-left: auto;
}

.list__style .bookmark__btn {
    margin-left: 12px;
}

/* Notification Toast Styles */
#favorites-message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 280px;
    max-width: 400px;
}

#favorites-message-container .alert {
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 15px 20px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#favorites-message-container .alert.fade {
    animation: slideOutRight 0.3s ease;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Success message */
#favorites-message-container .alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Error message */
#favorites-message-container .alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Close button */
#favorites-message-container .btn-close {
    padding: 0.5rem;
    opacity: 0.6;
}

#favorites-message-container .btn-close:hover {
    opacity: 1;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .bookmark__btn {
        border-color: rgba(255, 255, 255, 0.15);
        color: #adb5bd;
    }
    
    .bookmark__btn:hover {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .bookmark__btn.favorited {
        color: #5cb85c;
        border-color: rgba(92, 184, 92, 0.3);
        background: rgba(92, 184, 92, 0.1);
    }
}

/* Print Styles - Hide bookmarks when printing */
@media print {
    .bookmark__btn {
        display: none !important;
    }
}

/* Accessibility */
.bookmark__btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.bookmark__btn:focus:not(:focus-visible) {
    outline: none;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .bookmark__btn {
        border-width: 2px;
    }
    
    .bookmark__btn.favorited {
        border-width: 2px;
        font-weight: bold;
    }
}
