/**
 * Favorites System Styles
 * Modern, accessible, and performant CSS for job favoriting feature
 */

/* ===================================
   FAVORITE BUTTON STYLES
   =================================== */

.favorite-btn {
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    color: #9CA3AF; /* gray-400 */
    background: transparent;
    border: none;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.favorite-btn:hover {
    transform: scale(1.15);
    color: #EF4444; /* red-500 */
    background: rgba(239, 68, 68, 0.1);
}

.favorite-btn:active {
    transform: scale(0.95);
}

.favorite-btn.favorited {
    color: #EF4444; /* red-500 */
}

.favorite-btn.favorited:hover {
    color: #DC2626; /* red-600 */
}

/* Loading state */
.favorite-btn.loading {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Disabled state */
.favorite-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Focus state for accessibility */
.favorite-btn:focus {
    outline: 2px solid #EF4444;
    outline-offset: 2px;
}

.favorite-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Icon sizing */
.favorite-btn i {
    font-size: 1.5rem;
    transition: all 200ms ease;
}

/* ===================================
   ANIMATIONS
   =================================== */

/* Pulse animation on click */
@keyframes heartPulse {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(1.25);
    }
    100% {
        transform: scale(1);
    }
}

.favorite-btn.animating i {
    animation: heartPulse 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bounce animation for add */
@keyframes bounceIn {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.favorite-btn.favorited i {
    animation: bounceIn 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Fade animation for remove */
@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* ===================================
   LARGE FAVORITE BUTTON (Job Detail Page)
   =================================== */

.favorite-btn-large {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid #E5E7EB;
    border-radius: 0.5rem;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
}

.favorite-btn-large:hover {
    border-color: #EF4444;
    color: #EF4444;
    background: rgba(239, 68, 68, 0.05);
}

.favorite-btn-large.favorited {
    border-color: #EF4444;
    background: #EF4444;
    color: white;
}

.favorite-btn-large.favorited:hover {
    background: #DC2626;
    border-color: #DC2626;
}

.favorite-btn-large i {
    font-size: 1rem;
    transition: transform 200ms ease;
}

.favorite-btn-large:hover i {
    transform: scale(1.2);
}

/* ===================================
   ICON-ONLY FAVORITE BUTTON (Compact)
   =================================== */

.favorite-btn-icon {
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.favorite-btn-icon:hover {
    transform: scale(1.1);
    border-color: #EF4444;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.favorite-btn-icon:active {
    transform: scale(0.95);
}

.favorite-btn-icon.favorited {
    border-color: #EF4444;
    background: #FFFFFF;
}

.favorite-btn-icon i {
    font-size: 16px;
    color: #9CA3AF;
    transition: all 200ms ease;
}

.favorite-btn-icon.favorited i {
    color: #EF4444;
}

.favorite-btn-icon:hover i {
    color: #EF4444;
    transform: scale(1.1);
}

/* Loading state */
.favorite-btn-icon.loading {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Disabled state */
.favorite-btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Focus state for accessibility */
.favorite-btn-icon:focus {
    outline: 2px solid #EF4444;
    outline-offset: 2px;
}

.favorite-btn-icon:focus:not(:focus-visible) {
    outline: none;
}

/* ===================================
   NAVIGATION BADGE
   =================================== */

.favorites-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    background: #EF4444;
    color: white;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    margin-left: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Position badge on nav link */
.nav-link {
    position: relative;
}

.nav-link .favorites-badge {
    position: static;
    margin-left: auto;
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(400px);
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
}

/* Toast types */
.toast-success {
    border-left: 4px solid #10B981;
}

.toast-success .toast-icon {
    color: #10B981;
}

.toast-error {
    border-left: 4px solid #EF4444;
}

.toast-error .toast-icon {
    color: #EF4444;
}

.toast-info {
    border-left: 4px solid #3B82F6;
}

.toast-info .toast-icon {
    color: #3B82F6;
}

/* ===================================
   FAVORITES PAGE - EMPTY STATE
   =================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 0.5rem;
}

.empty-state i {
    font-size: 4rem;
    color: #D1D5DB;
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: #6B7280;
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.empty-state .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #3B82F6;
    color: white;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 200ms ease;
}

.empty-state .btn-primary:hover {
    background: #2563EB;
}

/* ===================================
   FAVORITES PAGE - JOB CARD
   =================================== */

.favorite-job-card {
    position: relative;
    transition: all 200ms ease;
}

.favorite-job-card.removing {
    animation: fadeOut 300ms ease forwards;
}

.favorited-date {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.favorited-date i {
    font-size: 0.625rem;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {
    /* Larger touch targets on mobile */
    .favorite-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .favorite-btn i {
        font-size: 1.25rem;
    }

    /* Toast positioning */
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Empty state */
    .empty-state {
        padding: 3rem 1.5rem;
    }

    .empty-state i {
        font-size: 3rem;
    }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.hidden {
    display: none !important;
}

/* Prevent text selection on buttons */
.favorite-btn,
.favorite-btn-large {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth fade transition */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 300ms ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 300ms ease;
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .favorite-btn {
        border: 2px solid currentColor;
    }

    .favorite-btn.favorited {
        background: #EF4444;
        color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .favorite-btn,
    .favorite-btn i,
    .toast {
        transition: none;
        animation: none;
    }

    .favorite-btn.animating i {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .toast {
        background: #1F2937;
    }

    .toast-message {
        color: #F3F4F6;
    }

    .empty-state {
        background: #1F2937;
    }

    .empty-state h3 {
        color: #F9FAFB;
    }

    .empty-state p {
        color: #D1D5DB;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    .favorite-btn,
    .favorite-btn-large,
    .toast-container {
        display: none !important;
    }
}
