/**
 * Period Switcher Styles
 *
 * Toast notifications and UI enhancements for period switching.
 * Follows AdminLTE color scheme and design patterns.
 */

/* ===== Toast Container ===== */
#pms-toast-container {
    position: fixed;
    top: 70px; /* Below header */
    right: 20px;
    z-index: 9999;
    pointer-events: none; /* Allow clicks through container */
}

/* ===== Toast Base ===== */
.pms-toast {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    min-width: 320px;
    max-width: 450px;
    pointer-events: all; /* But not through toasts */
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #3c8dbc;
    overflow: hidden;
    position: relative;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pms-toast.removing {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ===== Toast Content ===== */
.pms-toast-content {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 12px;
}

.pms-toast-content i {
    font-size: 20px;
    flex-shrink: 0;
}

.pms-toast-message {
    flex: 1;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

/* ===== Toast Actions ===== */
.pms-toast-actions {
    display: flex;
    gap: 8px;
    padding: 0 15px 15px 47px; /* Align with message (15px + 20px icon + 12px gap) */
}

.pms-toast-undo {
    background: #3c8dbc;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pms-toast-undo:hover {
    background: #367fa9;
}

.pms-toast-undo:active {
    background: #2e6c91;
}

.pms-toast-undo i {
    font-size: 12px;
}

.pms-toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pms-toast-close:hover {
    color: #333;
}

/* ===== Progress Bar (Countdown Visualization) ===== */
.pms-toast-progress {
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.pms-toast-progress-bar {
    height: 100%;
    background: rgba(60, 141, 188, 0.5);
    width: 0;
    transition: width 0.1s linear;
}

/* ===== Toast Type Variants ===== */

/* Success (Green) */
.pms-toast-success {
    border-left-color: #00a65a;
}

.pms-toast-success .pms-toast-content i {
    color: #00a65a;
}

.pms-toast-success .pms-toast-progress-bar {
    background: rgba(0, 166, 90, 0.5);
}

/* Error (Red) */
.pms-toast-error {
    border-left-color: #dd4b39;
}

.pms-toast-error .pms-toast-content i {
    color: #dd4b39;
}

.pms-toast-error .pms-toast-progress-bar {
    background: rgba(221, 75, 57, 0.5);
}

/* Info (Light Blue) */
.pms-toast-info {
    border-left-color: #00c0ef;
}

.pms-toast-info .pms-toast-content i {
    color: #00c0ef;
}

.pms-toast-info .pms-toast-progress-bar {
    background: rgba(0, 192, 239, 0.5);
}

/* Warning (Orange) */
.pms-toast-warning {
    border-left-color: #f39c12;
}

.pms-toast-warning .pms-toast-content i {
    color: #f39c12;
}

.pms-toast-warning .pms-toast-progress-bar {
    background: rgba(243, 156, 18, 0.5);
}

/* ===== Loading Overlay ===== */
.period-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.period-loading-spinner {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.period-loading-spinner i {
    font-size: 18px;
}

/* ===== Switch Page Enhancements ===== */

/* Period links with hover effects */
[data-switch-period] {
    transition: opacity 0.2s, transform 0.2s;
}

[data-switch-period]:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

[data-switch-period].disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ===== Dropdown Loading State ===== */
#period-switcher:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f4f4f4;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    /* Adjust toast container for mobile */
    #pms-toast-container {
        right: 10px;
        left: 10px;
        top: 60px;
    }

    /* Full width toasts on mobile */
    .pms-toast {
        min-width: 0;
        max-width: 100%;
    }

    /* Smaller padding on mobile */
    .pms-toast-content {
        padding: 12px;
    }

    .pms-toast-actions {
        padding: 0 12px 12px 39px;
    }

    /* Smaller fonts on mobile */
    .pms-toast-message {
        font-size: 13px;
    }

    .pms-toast-undo {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* ===== Print Styles ===== */
@media print {
    /* Hide toasts when printing */
    #pms-toast-container,
    .period-loading-overlay {
        display: none !important;
    }
}

/* ===== Accessibility Improvements ===== */

/* Focus states for keyboard navigation */
.pms-toast-undo:focus {
    outline: 2px solid #3c8dbc;
    outline-offset: 2px;
}

.pms-toast-close:focus {
    outline: 2px solid #999;
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .pms-toast {
        animation: none;
    }

    .pms-toast.removing {
        animation: none;
        opacity: 0;
    }

    .pms-toast-progress-bar {
        transition: none;
    }
}

/* ===== High Contrast Mode Support ===== */
@media (prefers-contrast: high) {
    .pms-toast {
        border: 2px solid currentColor;
    }

    .pms-toast-undo {
        border: 2px solid white;
    }
}
