/* ========================================
   Inventory Management (Lagerhaltung) CSS
   ======================================== */

/* ============================================
   1. OVERVIEW TABLE STYLING
   ============================================ */

.my-custom-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e2e7f1;
    border-radius: 6px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.my-custom-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.my-custom-table thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.my-custom-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
    border-bottom: 2px solid #e2e7f1;
    white-space: nowrap;
    background-color: #f8f9fa;
}

.my-custom-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e7f1;
    color: #495057;
    font-size: 0.95rem;
}

.my-custom-table tbody tr {
    transition: background-color 0.2s ease;
}

.my-custom-table tbody tr:hover {
    background-color: #f0f7ff;
}

.my-custom-table tbody tr:last-child td {
    border-bottom: none;
}

/* Action buttons in table */
.my-custom-table button {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    margin-right: 6px;
    transition: all 0.2s ease;
}

.my-custom-table .btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* ============================================
   2. PURCHASE SCHEDULE TABLE (60 MONTHS)
   ============================================ */

.table-container2 {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e2e7f1;
    border-radius: 6px;
    margin-top: 20px;
    background-color: #fff;
}

#scroll-horizontal-datatable {
    width: 100%;
    border-collapse: collapse;
}

#scroll-horizontal-datatable thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

#scroll-horizontal-datatable th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    border: 1px solid #e2e7f1;
    background-color: #f8f9fa;
    white-space: nowrap;
}

#scroll-horizontal-datatable td {
    padding: 10px 8px;
    text-align: right;
    border: 1px solid #e2e7f1;
    color: #495057;
    font-size: 0.9rem;
}

#scroll-horizontal-datatable tbody tr:hover {
    background-color: #f0f7ff;
}

/* Right-aligned numeric columns */
#scroll-horizontal-datatable td.numeric {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* Summary row (if present) */
#scroll-horizontal-datatable tr.summary-row {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: 2px solid #3498db;
}

#scroll-horizontal-datatable tr.summary-row td {
    background-color: #f8f9fa;
    border-top: 2px solid #3498db;
}

/* ============================================
   3. MODAL & FORM STYLING
   ============================================ */

/* Modal header */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px 8px 0 0;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Tab navigation */
.nav-tabs {
    border-bottom: 2px solid #e2e7f1;
    margin-bottom: 20px;
}

.nav-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    padding: 12px 24px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: #3498db;
    color: #3498db;
}

.nav-tabs .nav-link.active {
    color: #fff;
    background-color: #3498db;
    border-bottom-color: #3498db;
    border-radius: 4px 4px 0 0;
}

/* Tab pane */
.tab-pane {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form labels in modal */
.modal .form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.modal .form-label strong {
    color: #3498db;
}

/* Help text under labels */
.modal .form-label + p {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 12px;
    font-style: italic;
}

/* Form controls in modal */
.modal .form-control,
.modal .form-select {
    border-color: #e2e7f1;
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ============================================
   4. PURCHASE SCHEDULE ITEMS
   ============================================ */

.purchase-item-row {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.purchase-item-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.purchase-item-row .form-control {
    font-size: 0.95rem;
    padding: 8px 12px;
}

.purchase-item-row .btn-remove {
    align-self: flex-end;
    padding: 8px 12px;
    background-color: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.purchase-item-row .btn-remove:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* Template (hidden) */
#purchase-schedule-item-template {
    display: none;
}

/* ============================================
   5. SUMMARY PREVIEW
   ============================================ */

#summary-preview {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-left: 4px solid #3498db;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
}

#summary-preview > div {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(52, 152, 219, 0.1);
    font-size: 0.95rem;
}

#summary-preview > div:last-child {
    border-bottom: none;
}

#summary-preview strong {
    color: #2c3e50;
    font-weight: 600;
    margin-right: 12px;
    min-width: 150px;
}

#summary-preview span {
    color: #3498db;
    font-weight: 500;
    text-align: right;
}

/* ============================================
   6. MODAL BUTTONS
   ============================================ */

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e2e7f1;
    padding: 16px;
}

.modal-footer .btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-footer .btn-primary {
    background-color: #3498db;
    border-color: #3498db;
}

.modal-footer .btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}

.modal-footer .btn-secondary {
    background-color: #95a5a6;
    border-color: #95a5a6;
    color: #fff;
}

.modal-footer .btn-secondary:hover {
    background-color: #7f8c8d;
    border-color: #7f8c8d;
}

.modal-footer .btn-light {
    background-color: #ecf0f1;
    color: #495057;
    border-color: #bdc3c7;
}

.modal-footer .btn-light:hover {
    background-color: #d5dbdb;
    border-color: #a4afb5;
}

/* ============================================
   7. ACTION BUTTONS (ADD/EDIT)
   ============================================ */

#new-item-button {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    color: #fff;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

#new-item-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(52, 152, 219, 0.4);
}

#new-item-button i {
    margin-right: 8px;
}

/* ============================================
   8. CARD STYLING
   ============================================ */

.card {
    border: 1px solid #e2e7f1;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    margin-bottom: 25px;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 24px;
}

.card-title,
.header-title {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

/* ============================================
   9. RESPONSIVE DESIGN
   ============================================ */

/* Tablets and smaller */
@media (max-width: 768px) {
    .my-custom-table th,
    .my-custom-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .nav-tabs .nav-link {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .purchase-item-row {
        flex-direction: column;
        gap: 10px;
    }

    .purchase-item-row .btn-remove {
        align-self: flex-start;
    }

    #scroll-horizontal-datatable th {
        font-size: 0.8rem;
        padding: 8px 4px;
    }

    #scroll-horizontal-datatable td {
        font-size: 0.85rem;
        padding: 8px 4px;
    }

    .card-body {
        padding: 16px;
    }

    #new-item-button {
        width: 100%;
        margin-bottom: 15px;
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    .my-custom-table {
        font-size: 0.8rem;
    }

    .my-custom-table th,
    .my-custom-table td {
        padding: 8px;
    }

    .modal-dialog {
        margin: 10px;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    #summary-preview > div {
        flex-direction: column;
        gap: 5px;
    }

    #summary-preview strong {
        min-width: auto;
        margin-right: 0;
    }
}

/* ============================================
   10. UTILITY CLASSES
   ============================================ */

.text-muted {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.alert {
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    border: none;
}

.alert-light {
    background-color: #f8f9fa;
    color: #495057;
    border-left: 4px solid #3498db;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

/* ============================================
   11. HEADER STYLING
   ============================================ */

h1[data-translate],
h2[data-translate],
h3[data-translate],
h4[data-translate] {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 20px;
}

h1[data-translate] {
    font-size: 1.8rem;
    border-bottom: 3px solid #3498db;
    padding-bottom: 12px;
    margin-bottom: 25px;
}

h4.header-title {
    font-size: 1.1rem;
    color: #2c3e50;
}

/* ============================================
   12. CHART PLACEHOLDER
   ============================================ */

.apex-charts {
    min-height: 300px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    font-weight: 500;
}

#inventory-chart {
    width: 100%;
    min-height: 350px;
}

/* ============================================
   13. LOADING & EMPTY STATES
   ============================================ */

.no-data-message {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-size: 1rem;
}

.no-data-message i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e2e7f1;
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   14. PRINT STYLING
   ============================================ */

@media print {
    .modal-footer,
    #new-item-button,
    .btn-remove,
    .btn-edit,
    .btn-delete {
        display: none !important;
    }

    .my-custom-table,
    #scroll-horizontal-datatable {
        page-break-inside: avoid;
    }

    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}
