/* ZERP Component Styles */

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

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

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

.empty-state p {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Search Components */
.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8fafc;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Filter Components */
.filter-panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: block;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-tag {
    background-color: #eff6ff;
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-tag .remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
}

.filter-tag .remove:hover {
    opacity: 1;
}

/* Data Table Enhancements */
.table-container {
    position: relative;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-actions .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.table-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.table-info {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Row Selection */
.table tbody tr.selected {
    background-color: #eff6ff;
}

.table tbody tr.selected td {
    border-color: #dbeafe;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    min-width: max-content;
}

@media (max-width: 767.98px) {
    .action-buttons {
        min-width: unset;
    }
}

.action-buttons .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.success {
    background-color: var(--secondary-color);
}

.status-dot.warning {
    background-color: #f59e0b;
}

.status-dot.danger {
    background-color: #ef4444;
}

.status-dot.info {
    background-color: var(--accent-color);
}

.status-dot.secondary {
    background-color: #6b7280;
}

/* Stock Level Indicators */
.stock-level {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.stock-level.high {
    color: var(--secondary-color);
}

.stock-level.medium {
    color: #f59e0b;
}

.stock-level.low {
    color: #ef4444;
}

.stock-level.out {
    color: #6b7280;
}

/* Form Validation */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group.has-error .form-control {
    border-color: #ef4444;
}

.form-group.has-error .form-control:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.25);
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.form-group.has-error .error-message {
    display: block;
}

.required-field {
    color: #ef4444;
}

/* Multi-step Form */
.form-step-container {
    position: relative;
}

.form-step {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.form-step.active {
    display: block;
}

.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.step-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.step-progress .step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.step-progress .step.active {
    background-color: var(--primary-color);
    color: white;
}

.step-progress .step.completed {
    background-color: var(--secondary-color);
    color: white;
}

.step-progress .step-line {
    width: 40px;
    height: 2px;
    background-color: #e5e7eb;
    transition: background-color 0.3s ease;
}

.step-progress .step-line.completed {
    background-color: var(--secondary-color);
}

/* Modal Enhancements */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

.modal-dialog {
    margin: 1.75rem auto;
}

.modal-xl {
    max-width: 1200px;
}

.modal-lg {
    max-width: 800px;
}

/* Prevent page shift when modal opens */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

/* Ensure modals are clickable */
.modal-content {
    pointer-events: auto;
}

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.notification {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
}

.notification.success {
    border-left: 4px solid var(--secondary-color);
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification.warning {
    border-left: 4px solid #f59e0b;
}

.notification.info {
    border-left: 4px solid var(--accent-color);
}

.notification-icon {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
}

.notification-message {
    color: #6b7280;
    margin: 0;
    font-size: 0.875rem;
}

.notification-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-left: 0.5rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dropdown Enhancements */
.dropdown-menu {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-color);
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e5e7eb;
}

/* Tooltip Enhancements */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--text-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

/* Print Styles */
@media print {
    .sidebar,
    .top-header,
    .btn,
    .pagination,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .page-content {
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .table {
        border-collapse: collapse !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
}

/* Accessibility Enhancements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --secondary-color: #008000;
        --text-color: #000000;
        --background-color: #ffffff;
    }
    
    .card {
        border: 2px solid #000000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.page-actions .btn {
    transition: all 0.2s ease;
}

.page-actions .btn-primary {
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

.page-actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-icon-only i {
    margin: 0 !important;
}

[data-bs-toggle="tooltip"] {
    cursor: pointer;
}

.filter-form {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-form .form-control,
.filter-form .form-select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-form .form-control:focus,
.filter-form .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
}

.search-input-wrapper .form-control {
    padding-left: 38px;
}

@media (max-width: 768px) {
    .page-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .page-actions .btn-primary {
        flex: 1;
    }
}