/* Supplies module styles — extracted from views/supplies/dashboard.php (v1.35.0) */

/* Supplies Module Styles */
.supplies-container {
    padding: 0;
}

.supplies-sub-tabs {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.supplies-sub-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #4b5563;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}

.supplies-sub-tab:hover {
    background: #e5e7eb;
}

.supplies-sub-tab.active {
    background: #fff;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.supplies-sub-content {
    display: none;
}

.supplies-sub-content.active {
    display: block;
}

/* Stock Overview */
.supplies-stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.supply-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.15s;
}

.supply-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.supply-card.below-par {
    border-color: #fde68a;
    background: #fffbeb;
}

.supply-card.critical {
    border-color: #fecaca;
    background: #fef2f2;
}

.supply-photo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
    flex-shrink: 0;
}

.supply-photo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.supply-info {
    flex: 1;
    min-width: 80px;
}

.supply-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 2px;
}

.supply-meta {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
}

.supply-stock-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.supply-location-badge {
    text-align: center;
    padding: 6px 8px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    min-width: 48px;
}

.supply-location-badge.low {
    background: #fffbeb;
    border-color: #fde68a;
}

.supply-location-badge.critical {
    background: #fef2f2;
    border-color: #fecaca;
}

.supply-location-badge .qty {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    display: block;
}

.supply-location-badge .loc-label {
    font-size: 9px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Transfer Needs */
.transfer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transfer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.transfer-item .supply-name {
    flex: 1;
}

.transfer-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transfer-qty input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.transfer-btn-action {
    padding: 6px 14px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.transfer-btn-action:hover {
    background: #2563eb;
}

/* Category Header */
.category-header {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 0 6px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 10px;
    margin-top: 16px;
}

.category-header:first-child {
    margin-top: 0;
}

/* Check UI */
.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 8px;
}

.check-item.checked {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.check-item.discrepancy {
    background: #fef2f2;
    border-color: #fecaca;
}

.check-item-photo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #f3f4f6;
}

.check-item-info {
    flex: 1;
}

.check-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.check-item-expected {
    font-size: 12px;
    color: #6b7280;
}

.check-item-input {
    width: 70px;
    padding: 8px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.check-item-input:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Check progress bar */
.check-progress {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.check-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.check-progress-fill {
    height: 100%;
    background: #10b981;
    border-radius: 3px;
    transition: width 0.3s;
}

.check-progress-text {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* Check action buttons (sticky footer on mobile) */
.check-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

/* Hide mobile card view on desktop */
.manage-items-mobile {
    display: none;
}

/* Mobile optimizations for checks */
@media (max-width: 768px) {
    .check-item {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 14px;
        gap: 10px;
    }

    .check-item-photo,
    .supply-photo-placeholder {
        width: 44px;
        height: 44px;
    }

    .check-item-info {
        flex: 1;
        min-width: 0;
    }

    .check-item-name {
        font-size: 15px;
        line-height: 1.3;
    }

    .check-item-expected {
        font-size: 13px;
        margin-top: 2px;
    }

    .check-item-input {
        width: 80px;
        height: 48px;
        font-size: 20px;
        font-weight: 700;
        border-radius: 10px;
        border-width: 2px;
    }

    .check-item-input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }

    .check-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 12px 0;
        border-top: 1px solid #e5e7eb;
        margin: 0 -14px;
        padding: 12px 14px;
        z-index: 50;
    }

    .check-actions .btn-primary {
        padding: 14px 16px;
        font-size: 15px;
        font-weight: 600;
        border-radius: 10px;
    }

    .check-progress {
        position: sticky;
        top: 0;
        padding: 10px 0;
        margin: 0 -14px 12px;
        padding-left: 14px;
        padding-right: 14px;
        background: #fff;
        z-index: 50;
    }

    .check-progress-bar {
        height: 8px;
        border-radius: 4px;
    }

    .check-progress-text {
        font-size: 13px;
        font-weight: 500;
    }

    /* Larger category headers on mobile */
    .check-items-list .category-header {
        font-size: 14px;
        padding: 14px 0 8px;
        position: sticky;
        top: 50px;
        background: #fff;
        z-index: 40;
    }

    /* Location selector bigger on mobile */
    #spot-check-location,
    #full-check-location {
        height: 44px;
        font-size: 15px;
        padding: 8px 12px;
    }

    /* Start check button bigger on mobile */
    #start-spot-check,
    #start-full-check {
        padding: 20px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
    }
}

/* Empty state */
.supplies-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.supplies-empty .empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

/* Add Stock button on supply cards */
.add-stock-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 2px solid #10b981;
    background: #ecfdf5;
    color: #10b981;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    line-height: 1;
    padding: 0;
}

.add-stock-btn:hover {
    background: #10b981;
    color: #fff;
    transform: scale(1.1);
}

/* Editable quantity badges (admin) */
.supply-location-badge.editable-qty {
    cursor: pointer;
    position: relative;
}

.supply-location-badge.editable-qty:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.supply-location-badge.editable-qty:hover .qty {
    color: #3b82f6;
}

.supply-location-badge.editable-qty::after {
    content: '✎';
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 9px;
    color: #9ca3af;
    opacity: 0;
    transition: opacity 0.15s;
}

.supply-location-badge.editable-qty:hover::after {
    opacity: 1;
}

.inline-qty-input {
    width: 48px;
    padding: 2px 4px;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    outline: none;
    display: block;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .add-stock-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 22px;
    }

    .inline-qty-input {
        width: 56px;
        font-size: 18px;
        padding: 4px 6px;
    }

    .supply-location-badge.editable-qty::after {
        opacity: 0.5;
    }
}

/* Admin item form */
.supply-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.supply-form-grid .form-group.full-width {
    grid-column: 1 / -1;
}

#supply-item-modal .form-group select {
    height: auto;
    padding: 8px 36px 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    overflow: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#supply-item-modal .form-group input,
#supply-item-modal .form-group select {
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 13px;
}

#supply-item-modal .form-group label {
    font-size: 12px;
    margin-bottom: 3px;
    color: #4b5563;
}

#supply-item-modal .form-group {
    margin-bottom: 0;
}

#supplies-settings-content .form-group select,
#supplies-settings-content select {
    height: auto;
    padding: 10px 36px 10px 12px;
    font-size: 14px;
    line-height: 1.4;
    overflow: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#supplies-settings-content .form-group input {
    box-sizing: border-box;
}

/* Mobile */
@media (max-width: 768px) {
    .supplies-sub-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .supplies-stock-grid {
        grid-template-columns: 1fr;
    }

    .supply-form-grid {
        grid-template-columns: 1fr;
    }

    .supply-card {
        flex-wrap: wrap;
    }

    .supply-stock-badges {
        width: 100%;
        justify-content: flex-end;
    }

    /* Mobile modal */
    #supply-item-modal .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    #supply-item-modal .modal-header {
        flex-shrink: 0;
    }

    #supply-item-modal .modal-body {
        flex: 1;
        overflow-y: auto;
        max-height: none !important;
        -webkit-overflow-scrolling: touch;
    }

    #supply-item-modal .modal-footer {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 14px 24px;
        border-top: 1px solid #e5e7eb;
    }

    #supply-item-modal .modal-footer .modal-btn {
        padding: 14px 20px;
        font-size: 15px;
    }

    #supply-item-modal .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    #supply-item-modal .form-group input,
    #supply-item-modal .form-group select,
    #supply-item-modal .form-group textarea {
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
    }

    #supply-item-modal .form-group select {
        height: auto;
        padding: 12px 36px 12px 12px;
    }

    /* Transfer needs mobile */
    .transfer-item {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px;
    }

    .transfer-item .supply-info {
        flex: 1 1 100%;
        order: 1;
    }

    .transfer-item .supply-photo-placeholder,
    .transfer-item .check-item-photo {
        order: 0;
    }

    .transfer-qty {
        order: 2;
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid #f3f4f6;
    }

    .transfer-qty input {
        width: 70px;
        height: 44px;
        font-size: 16px;
    }

    .transfer-btn-action {
        padding: 10px 18px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Reorder needs mobile */
    #supplies-reorder-content .transfer-item {
        flex-wrap: wrap;
    }

    #supplies-reorder-content .transfer-btn-action {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
        padding: 12px;
        font-size: 14px;
        border-radius: 8px;
        text-align: center;
    }

    /* Manage items mobile - card view instead of table */
    #supplies-manage-content .manage-items-table {
        display: none;
    }

    #supplies-manage-content .manage-items-mobile {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    #supplies-manage-content {
        overflow-x: visible;
    }

    /* Section headers on mobile */
    .supplies-sub-content > div:first-child {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start !important;
    }

    .supplies-sub-content > div:first-child .btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* Transfer all button */
    #transfer-all-btn {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }
}

/* Trends Summary Cards */
.trends-summary-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.trends-card {
    flex: 1;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
}

.trends-card.critical {
    background: #fef2f2;
    border-color: #fecaca;
}

.trends-card.warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.trends-card-value {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.trends-card.critical .trends-card-value { color: #dc2626; }
.trends-card.warning .trends-card-value { color: #d97706; }

.trends-card-label {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

/* Trends Bar Chart */
.trends-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.trends-chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.trends-chart-bar-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.trends-chart-bar {
    width: 40%;
    min-width: 8px;
    max-width: 24px;
    border-radius: 3px 3px 0 0;
    transition: height 0.3s;
}

.trends-chart-bar.inflow {
    background: #10b981;
}

.trends-chart-bar.consumed {
    background: #f87171;
}

.trends-chart-label {
    font-size: 10px;
    color: #6b7280;
    margin-top: 4px;
    white-space: nowrap;
}

.trends-chart-value {
    font-size: 9px;
    color: #9ca3af;
    margin-top: 1px;
}

.trends-row:hover {
    background: #f9fafb;
}

@media (max-width: 768px) {
    .trends-summary-cards {
        flex-direction: column;
        gap: 8px;
    }

    .trends-chart {
        height: 100px;
        overflow-x: auto;
        min-width: 400px;
    }
}
