/* CSS Variables for consistency */
:root {
    --primary-color: #28313b;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --dark-bg: #212529;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--light-bg);
    color: #212529;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    padding: 16px;
}

/* Main container */
.container-fluid {
    max-width: 100%;
    margin: 0 auto;
}

/* Heading */
h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--dark-bg);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

h1 i {
    font-size: 20px;
    color: var(--primary-color);
}

/* Card styles */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: none;
}

.card-header {
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
}

.card-header h5 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-bg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* Form styles */
.form-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control,
.form-select {
    font-size: 13px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Button styles */
.btn {
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1c252d;
}

.btn-secondary {
    background-color: var(--text-muted);
    border-color: var(--text-muted);
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Table styles */
.table {
    font-size: 13px;
    width: 100%;
    min-width: 300px;
}

.table th {
    background-color: var(--light-bg);
    font-weight: 500;
    color: var(--dark-bg);
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

.unit-name {
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: underline;
}

.unit-name:hover {
    color: #1c252d;
}

/* Category rows (vertical stacking) */
.category-rows {
    display: block;
}

/* Category container for each horizontal row */
.category-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.category-section {
    display: inline-block;
    vertical-align: top;
    width: 400px;
}

.category-section h6 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-bg);
    margin-bottom: 12px;
    padding: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    white-space: normal;
    word-wrap: break-word;
}

/* Modal styles */
.modal-content {
    border-radius: 8px;
}

.modal-header {
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1000;
}

.loading .spinner-border {
    width: 24px;
    height: 24px;
}

.loading span {
    font-size: 14px;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--dark-bg);
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--danger-color);
}

.notification .btn-close {
    margin-left: auto;
}

/* Image styles for table */
.category-section img {
    object-fit: cover;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 20px;
    }

    .card-body {
        padding: 16px;
    }

    .table {
        font-size: 12px;
    }

    .btn {
        padding: 6px 12px;
    }

    .notification {
        top: 10px;
        right: 10px;
        width: calc(100% - 20px);
    }

    .category-section {
        width: 300px;
    }
}