/* =====================================================
   Component Styles  
   Modal, Toast, & additional shared components
   ===================================================== */

/* --- Custom Modal --- */
.frozen-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: var(--spacing-md);
}

.frozen-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.frozen-modal {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.frozen-modal-overlay.show .frozen-modal {
    transform: scale(1) translateY(0);
}

.frozen-modal.modal-sm { max-width: 360px; }
.frozen-modal.modal-lg { max-width: 640px; }
.frozen-modal.modal-xl { max-width: 800px; }

.frozen-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.frozen-modal-header .modal-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
}

.frozen-modal-header .modal-icon.icon-success { background: var(--success-bg); color: var(--success); }
.frozen-modal-header .modal-icon.icon-danger { background: var(--danger-bg); color: var(--danger); }
.frozen-modal-header .modal-icon.icon-warning { background: var(--warning-bg); color: var(--warning); }
.frozen-modal-header .modal-icon.icon-info { background: var(--info-bg); color: var(--info); }

.frozen-modal-header .modal-title-group {
    flex: 1;
}

.frozen-modal-header .modal-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.frozen-modal-header .modal-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.frozen-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-light);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.frozen-modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.frozen-modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.frozen-modal-body .modal-message {
    font-size: 14px;
    color: var(--text-body);
    line-height: 1.6;
}

.frozen-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

/* --- Loading Modal --- */
.frozen-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.frozen-loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.frozen-loading-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl) var(--spacing-2xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-xl);
}

.frozen-loading-content .spinner {
    width: 44px;
    height: 44px;
    border-width: 4px;
}

.frozen-loading-content .loading-text {
    font-size: 14px;
    color: var(--text-body);
    font-weight: 500;
}

/* --- Toast Notifications --- */
.frozen-toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--spacing-md));
    right: var(--spacing-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 400px;
    width: calc(100% - 32px);
    pointer-events: none;
}

.frozen-toast {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 14px 16px;
    border-left: 4px solid var(--text-muted);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

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

.frozen-toast.hide {
    opacity: 0;
    transform: translateX(100%);
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
}

.frozen-toast.toast-success { border-left-color: var(--success); }
.frozen-toast.toast-error { border-left-color: var(--danger); }
.frozen-toast.toast-warning { border-left-color: var(--warning); }
.frozen-toast.toast-info { border-left-color: var(--info); }

.frozen-toast .toast-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }

.frozen-toast .toast-content {
    flex: 1;
    min-width: 0;
}

.frozen-toast .toast-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.frozen-toast .toast-message {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    word-wrap: break-word;
}

.frozen-toast .toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.frozen-toast .toast-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.frozen-toast .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--text-light);
    border-radius: 0 0 0 var(--border-radius);
    transition: width linear;
}

.toast-success .toast-progress { background: var(--success); }
.toast-error .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info .toast-progress { background: var(--info); }

/* --- Tabs --- */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* --- Dropdown --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-body);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--bg-light);
    color: var(--primary);
}

/* --- Tooltip (CSS only) --- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--text-dark);
    color: var(--white);
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
    z-index: 600;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* --- Product Image Thumbnail --- */
.product-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    object-fit: cover;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

.product-info-cell {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.product-info-cell .product-name {
    font-weight: 600;
    color: var(--text-dark);
}

.product-info-cell .product-code {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Switch Toggle --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    inset: 0;
    background: var(--text-light);
    border-radius: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.switch .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    top: 3px;
    left: 3px;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-light) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.skeleton-rect {
    height: 120px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
