/* ==========================================================================
   Modals - Notification Modal & Dialog Styles
   ========================================================================== */

.notification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.notification-modal {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.notification-modal h2 {
    margin: 0 0 1rem 0;
    color: #667eea;
    font-size: 1.5rem;
}

.notification-modal p {
    margin: 0.5rem 0;
    color: #555;
}

/* Form Elements */
.form-group {
    margin: 1.5rem 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.email-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Depot Checkboxes */
.depot-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9ff;
    border-radius: 6px;
    max-height: 250px;
    overflow-y: auto;
}

.depot-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.depot-checkbox:hover {
    background: #e8ebff;
}

.depot-checkbox input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.depot-checkbox input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

.btn-cancel,
.btn-confirm {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #e0e0e0;
    color: #333;
}

.btn-cancel:hover {
    background: #d0d0d0;
}

.btn-confirm {
    background: #667eea;
    color: white;
}

.btn-confirm:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ==========================================================================
   Product Stats Modal
   ========================================================================== */

.product-stats-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.product-stats-modal {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.product-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.product-stats-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.product-stats-content {
    padding: 2rem;
}

.product-info-section,
.inventory-stats-section,
.supplier-products-section {
    margin-bottom: 2rem;
}

.product-info-section h3,
.inventory-stats-section h3,
.supplier-products-section h3 {
    margin: 0 0 1rem 0;
    color: #667eea;
    font-size: 1.2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.product-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.info-value {
    color: #333;
    font-size: 1rem;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Simple Supplier List */
.supplier-simple-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8f9ff;
    padding: 1.5rem;
    border-radius: 8px;
}

.supplier-simple-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.supplier-simple-item.found {
    border-left: 4px solid #28a745;
}

.supplier-simple-item.not-found {
    border-left: 4px solid #dc3545;
}

.supplier-simple-label {
    font-weight: 600;
    color: #333;
    min-width: 120px;
    font-size: 1rem;
}

.supplier-simple-value {
    color: #667eea;
    font-weight: 600;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    user-select: all;
    padding: 0.5rem 1rem;
    background: #e8f4f8;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.supplier-simple-value:hover {
    background: #d0e9f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.supplier-simple-value:active {
    transform: translateY(0);
}

.supplier-simple-value-not-found {
    color: #999;
    font-style: italic;
    font-size: 0.95rem;
}

/* Copy tooltip */
.copy-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #28a745;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    animation: fadeInOut 1.5s ease;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
}

.no-stock-message {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
}

.out-of-stock-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.out-of-stock-notice p {
    margin: 0 0 1rem 0;
    color: #856404;
    font-weight: 600;
}

.notify-btn-modal {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.notify-btn-modal:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.product-stats-footer {
    padding: 1rem 2rem;
    border-top: 2px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    background: #f8f9ff;
    border-radius: 0 0 12px 12px;
}

.btn-close-modal {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Product name link styling */
.product-name-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.product-name-link:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Charts Section
   ========================================================================== */

.charts-section {
    margin-bottom: 2rem;
}

.charts-section h3 {
    margin: 0 0 1.5rem 0;
    color: #667eea;
    font-size: 1.2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.chart-container {
    margin-bottom: 2rem;
    background: #f8f9ff;
    padding: 1.5rem;
    border-radius: 8px;
}

.chart-container h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
}

.chart-container canvas {
    max-height: 300px;
}

.no-history-message {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9ff;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.no-history-message p {
    color: #666;
    margin: 0.5rem 0;
}

.no-history-message small {
    color: #999;
}

/* Stat box variations for positive/negative */
.stat-box.positive {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.stat-box.negative {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .product-stats-modal {
        width: 95%;
        max-width: none;
    }
    
    .product-info-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
    }
    
    .supplier-simple-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .supplier-simple-label {
        min-width: auto;
    }
    
    .supplier-simple-value {
        width: 100%;
        text-align: center;
    }
}
/* ==========================================================================
   Row Details Modal - Click on table row to expand details
   ========================================================================== */

.row-details-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.row-details-modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.row-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.row-details-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.row-details-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.row-details-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.row-details-content {
    padding: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
    gap: 1rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #667eea;
    min-width: 150px;
}

.detail-value {
    color: #333;
    word-break: break-word;
    flex: 1;
    text-align: right;
}

.qty-in-stock {
    color: #28a745;
    font-weight: 600;
}

.qty-out-of-stock {
    color: #dc3545;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Low Stock Modal Styles */
.low-stock-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

.low-stock-modal {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.low-stock-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.low-stock-modal .modal-header h2 {
    margin: 0;
    color: #667eea;
    font-size: 1.3rem;
}

.low-stock-modal .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s ease;
}

.low-stock-modal .modal-close:hover {
    color: #333;
}

.low-stock-modal .modal-content {
    margin-bottom: 1.5rem;
}

.low-stock-modal .modal-field {
    margin-bottom: 1.5rem;
}

.low-stock-modal .modal-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.low-stock-modal .modal-field input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.low-stock-modal .modal-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.low-stock-modal .modal-field input:disabled {
    background-color: #f5f5f5;
    color: #999;
}

.low-stock-modal .modal-info {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.low-stock-modal .modal-info p {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
}

.low-stock-modal .modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.low-stock-modal .modal-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.low-stock-modal .modal-btn-cancel {
    background-color: #e0e0e0;
    color: #333;
}

.low-stock-modal .modal-btn-cancel:hover {
    background-color: #d0d0d0;
}

.low-stock-modal .modal-btn-delete {
    background-color: #dc3545;
    color: white;
}

.low-stock-modal .modal-btn-delete:hover {
    background-color: #c82333;
}

.low-stock-modal .modal-btn-save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.low-stock-modal .modal-btn-save:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .row-details-overlay {
        padding: 0.5rem;
    }

    .row-details-modal {
        max-height: 95vh;
    }

    .row-details-header {
        padding: 1rem;
    }

    .row-details-header h2 {
        font-size: 1.1rem;
    }

    .row-details-content {
        padding: 1rem;
    }

    .detail-row {
        flex-direction: column;
        padding: 0.75rem 0;
    }

    .detail-label {
        min-width: auto;
        margin-bottom: 0.25rem;
    }

    .detail-value {
        text-align: left;
    }

    .low-stock-modal {
        width: 95%;
        padding: 1.5rem;
    }

    .low-stock-modal .modal-actions {
        flex-direction: column-reverse;
    }

    .low-stock-modal .modal-actions button {
        width: 100%;
    }
}

/* ==========================================================================
   Action Visibility Modal
   ========================================================================== */

.action-visibility-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

.action-visibility-modal {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.action-visibility-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.action-visibility-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.action-visibility-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-visibility-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.action-visibility-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.action-visibility-section {
    margin-bottom: 2rem;
}

.action-visibility-section h3 {
    margin: 0 0 1rem 0;
    color: #667eea;
    font-size: 1.1rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-toggle-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9ff;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.action-toggle-item:hover {
    background: #e8ebff;
}

.action-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    width: 100%;
    margin: 0;
    user-select: none;
}

.action-toggle-label span {
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
}

.action-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.action-visibility-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 2px solid #e0e0e0;
    background: #f8f9ff;
    border-radius: 0 0 12px 12px;
    justify-content: flex-end;
}

.btn-logout,
.btn-close {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout {
    background: #dc3545;
    color: white;
}

.btn-logout:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-close {
    background: #667eea;
    color: white;
}

.btn-close:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .action-visibility-modal {
        width: 95%;
        max-height: 90vh;
    }

    .action-visibility-header {
        padding: 1rem;
    }

    .action-visibility-header h2 {
        font-size: 1.1rem;
    }

    .action-visibility-content {
        padding: 1rem;
    }

    .action-visibility-footer {
        flex-direction: column-reverse;
        padding: 1rem;
    }

    .btn-logout,
    .btn-close {
        width: 100%;
    }
}
