/* WealthGenie-inspired IGFlow Styles */

:root {
    --color-primary: #0163BA;
    --color-secondary: #4A4478;
    --bg-light: #EBEDEF;
    --bg-white: #FFFFFF;
    --text-primary: #202C3D;
    --text-secondary: #4A4A4A;
    --text-heading: #2B2B2B;
    --border-color: #E0E0E0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-style: normal;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Styles */
.header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 30px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-brand .brand-link {
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-brand .brand-link:hover {
    opacity: 0.8;
}

.header-brand h2 {
    color: var(--color-primary);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-heading {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 2px;
}

.vertical-divider {
    width: 1px;
    height: 40px;
    background-color: var(--border-color);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-light);
    color: var(--color-primary);
}

.nav-link.active {
    background-color: var(--color-primary);
    color: white;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    z-index: 1000;
    margin-top: 0;
    padding-top: 8px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: var(--bg-light);
    color: var(--color-primary);
}

/* User Section */
.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.user-section:hover {
    background-color: var(--bg-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h1 {
    color: var(--text-heading);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 180px;
    background-color: white;
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-actions select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 160px;
    background-color: white;
}

.page-actions select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.page-actions .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filters-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    max-width: 200px;
}

.filters-bar .form-group label {
    font-size: 0.85rem;
    margin-bottom: 5px;
}

/* Timeframe Selector */
.timeframe-selector {
    display: flex;
    gap: 10px;
    background: white;
    padding: 4px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timeframe-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.timeframe-btn:hover {
    background: rgba(1, 99, 186, 0.08);
    color: var(--color-primary);
}

.timeframe-btn.active {
    background: var(--color-primary);
    color: white;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: white;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-primary:hover {
    background-color: var(--color-primary);
    color: white;
}

.btn-secondary {
    background-color: #f5f5f5;
    color: var(--text-primary);
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-danger {
    background-color: white;
    border: 2px solid #dc3545;
    color: #dc3545;
}

.btn-danger:hover {
    background-color: #dc3545;
    color: white;
}

.btn-info {
    background-color: white;
    border: 2px solid #17a2b8;
    color: #17a2b8;
}

.btn-info:hover {
    background-color: #17a2b8;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px 12px;
    min-width: auto;
    position: relative;
}

.btn-icon i {
    margin: 0;
}

/* Custom Tooltip for icon buttons */
.btn-icon[title] {
    overflow: visible;
}

.btn-icon[title]::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-bottom: 5px;
    z-index: 1000;
    pointer-events: none;
}

.btn-icon[title]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-bottom: -5px;
    z-index: 1000;
    pointer-events: none;
}

.btn-icon[title]:hover::after,
.btn-icon[title]:hover::before {
    opacity: 1;
    visibility: visible;
}

.btn-logout {
    background-color: #dc3545;
    color: white;
    border: none;
}

.btn-logout:hover {
    background-color: #c82333;
}

/* Cards */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    margin: 0;
    color: var(--text-heading);
    font-size: 1.2rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: #f8f9fa;
}

thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-heading);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9rem;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody td {
    padding: 12px 15px;
    color: var(--text-primary);
}

/* Forms */
.form-container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(1, 99, 186, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* Radio Button Group */
.radio-group {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.radio-option {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-custom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    transition: all 0.3s ease;
    min-height: 70px;
}

.radio-custom i {
    font-size: 20px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.radio-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.radio-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--color-primary);
    background-color: rgba(1, 99, 186, 0.05);
}

.radio-option input[type="radio"]:checked + .radio-custom i {
    color: var(--color-primary);
    transform: scale(1.1);
}

.radio-option input[type="radio"]:checked + .radio-custom .radio-label {
    color: var(--color-primary);
}

.radio-option:hover .radio-custom {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(1, 99, 186, 0.1);
}

.radio-option input[type="radio"]:disabled + .radio-custom {
    opacity: 0.6;
    cursor: not-allowed;
}

.radio-option:has(input[type="radio"]:disabled):hover .radio-custom {
    border-color: var(--border-color);
    box-shadow: none;
}

/* Item Rows (for gatepass) */
.item-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
    padding: 15px;
    background-color: var(--bg-light);
    border-radius: 6px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 900px;
}

.modal-confirm {
    max-width: 500px;
    animation: scaleIn 0.3s ease-out;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-heading);
    font-size: 1.3rem;
}

.modal-confirm .modal-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    border-bottom: none;
    padding-bottom: 10px;
}

.confirm-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.confirm-icon i {
    font-size: 35px;
    color: #dc3545;
}

.confirm-message {
    text-align: center;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-confirm .form-actions {
    justify-content: center;
    gap: 15px;
}

.modal-confirm .form-actions .btn {
    min-width: 120px;
}

.modal-body {
    padding: 30px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.close:hover {
    color: #000;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo i {
    margin-bottom: 15px;
}

.login-logo h1 {
    color: var(--color-primary);
    font-size: 2rem;
    margin: 10px 0 0 0;
}

.login-card h2 {
    color: var(--text-heading);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.login-card .btn-primary {
    width: 100%;
    background-color: var(--color-primary);
    color: white;
    border: 2px solid var(--color-primary);
    padding: 12px;
    font-weight: 600;
    font-size: 1rem;
}

.login-card .btn-primary:hover {
    background-color: #014a94;
    border-color: #014a94;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group-text {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(1, 99, 186, 0.1);
}

.error-message {
    color: #dc3545;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* Messages */
.message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
}

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

.message-success {
    background-color: #28a745;
    color: white;
}

.message-error {
    background-color: #dc3545;
    color: white;
}

/* Dashboard */
.dashboard-filters {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 30px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dashboard-filters-inline {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.dashboard-filters-inline .form-group {
    margin-bottom: 0;
}

.dashboard-filters-inline .form-group label {
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.dashboard-filters-inline .form-control {
    padding: 8px 10px;
    font-size: 0.9rem;
    min-width: 150px;
}

.dashboard-filters-inline select.form-control {
    min-width: 200px;
}

.dashboard-filters-inline .btn {
    white-space: nowrap;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card:nth-child(1) .stat-icon {
    background: rgba(75, 192, 192, 0.1);
    color: rgb(75, 192, 192);
}

.stat-card:nth-child(2) .stat-icon {
    background: rgba(255, 99, 132, 0.1);
    color: rgb(255, 99, 132);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-heading);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
}

.dashboard-card {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.dashboard-card h3 {
    color: var(--text-heading);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.1rem;
}

/* Stock Cards */
.stock-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.stock-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid var(--color-primary);
}

.stock-card h4 {
    color: var(--text-heading);
    margin-bottom: 10px;
    font-size: 1rem;
}

.stock-available {
    color: #28a745;
    font-weight: 600;
}

.stock-expired {
    color: #dc3545;
    font-weight: 600;
}

.has-expired {
    background-color: #fff3cd;
}

/* Status Badges */
.status-badge {
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge.inward {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-badge.dispatch {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.inactive {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Role Badge */
.role-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.role-badge.admin {
    background-color: #cce5ff;
    color: #004085;
}

.role-badge.operator {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Small Modal */
.modal-small {
    max-width: 400px;
}

/* Details Table */
.details-table {
    width: 100%;
    margin-top: 15px;
}

.details-table th,
.details-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.details-table thead {
    background-color: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 15px;
    }

    .header-stats {
        flex-wrap: wrap;
        gap: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
    }

    .timeframe-selector {
        width: 100%;
    }

    .timeframe-btn {
        flex: 1;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-bar .form-group {
        max-width: 100%;
    }

    .dashboard-filters-inline {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
    }

    .dashboard-filters-inline .form-control {
        min-width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

    .item-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-custom {
        padding: 10px;
        min-height: 60px;
    }

    .radio-custom i {
        font-size: 18px;
    }
}

/* ===== NEW DASHBOARD STYLES ===== */

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.kpi-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.kpi-blue .kpi-icon {
    background: rgba(1, 99, 186, 0.08);
    color: var(--color-primary);
}

.kpi-green .kpi-icon {
    background: rgba(1, 99, 186, 0.08);
    color: var(--color-primary);
}

.kpi-red .kpi-icon {
    background: rgba(220, 53, 69, 0.08);
    color: #b33a3a;
}

.kpi-orange .kpi-icon {
    background: rgba(1, 99, 186, 0.08);
    color: var(--color-primary);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
    margin-bottom: 2px;
}

.kpi-unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kpi-sublabel {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.kpi-sublabel span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.action-btn i {
    font-size: 1rem;
}

.action-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #014a94 100%);
}

.action-primary:hover {
    background: linear-gradient(135deg, #014a94 0%, #013770 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(1, 99, 186, 0.25);
}

.action-secondary {
    background: linear-gradient(135deg, #4A4478 0%, #3a3560 100%);
}

.action-secondary:hover {
    background: linear-gradient(135deg, #3a3560 0%, #2d2a4a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 68, 120, 0.25);
}

/* Alerts Section */
.alerts-section {
    margin-bottom: 35px;
}

.alerts-section h2 {
    color: var(--text-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.alert-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 15px;
    overflow: hidden;
}

.alert-red {
    border-left: 4px solid #b33a3a;
}

.alert-yellow {
    border-left: 4px solid #d4a574;
}

.alert-orange {
    border-left: 4px solid #c77e4d;
}

.alert-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.alert-header:hover {
    background-color: #f8f9fa;
}

.alert-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 1.05rem;
}

.alert-title i {
    font-size: 1.2rem;
}

.alert-red .alert-title i {
    color: #b33a3a;
}

.alert-yellow .alert-title i {
    color: #d4a574;
}

.alert-orange .alert-title i {
    color: #c77e4d;
}

.alert-count {
    background-color: var(--text-secondary);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.toggle-icon {
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.alert-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.alert-body.open {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

.filter-row {
    padding: 15px 20px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.filter-row label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.filter-row select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Alert Tables */
.alert-table {
    width: 100%;
    border-collapse: collapse;
}

.alert-table thead {
    background-color: #f8f9fa;
}

.alert-table thead th {
    padding: 12px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.alert-table tbody tr:last-child {
    border-bottom: none;
}

.alert-table tbody td {
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.days-critical {
    color: #b33a3a;
    font-weight: 600;
}

.days-warning {
    color: #d4a574;
    font-weight: 600;
}

.days-normal {
    color: var(--color-primary);
    font-weight: 600;
}

.qty-low {
    color: #c77e4d;
    font-weight: 600;
}

.empty-state {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
    font-size: 1rem;
    font-weight: 500;
}

/* Overview Section */
.overview-section {
    margin-bottom: 35px;
}

.overview-section h2 {
    color: var(--text-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.overview-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 25px;
}

.overview-card h3 {
    color: var(--text-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.top-products-table {
    width: 100%;
    border-collapse: collapse;
}

.top-products-table thead {
    background-color: #f8f9fa;
}

.top-products-table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-products-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.top-products-table tbody tr:last-child {
    border-bottom: none;
}

.top-products-table tbody td {
    padding: 12px 15px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.top-products-table .rank {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.1rem;
    width: 50px;
    text-align: center;
}

.top-products-table .qty {
    font-weight: 600;
    color: var(--text-heading);
}

/* Activity Section */
.activity-section {
    margin-bottom: 35px;
}

.activity-section h2 {
    color: var(--text-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

.activity-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 25px;
}

.activity-card h3 {
    color: var(--text-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.card-header-with-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.card-header-with-filter h3 {
    margin: 0;
    padding: 0;
    border: none;
}

.card-header-with-filter select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    background-color: white;
    min-width: 200px;
    cursor: pointer;
}

.card-header-with-filter select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-table thead {
    background-color: #f8f9fa;
}

.activity-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.activity-table tbody tr:last-child {
    border-bottom: none;
}

.activity-table tbody tr:hover {
    background-color: #f8f9fa;
}

.activity-table tbody td {
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.activity-table a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.activity-table a:hover {
    text-decoration: underline;
}

/* Responsive Dashboard */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .activity-grid {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        flex-direction: column;
        text-align: center;
    }

    .kpi-icon {
        width: 55px;
        height: 55px;
        font-size: 24px;
    }

    .kpi-value {
        font-size: 1.8rem;
    }

    .action-btn {
        padding: 15px 20px;
    }

    .alert-table,
    .activity-table,
    .top-products-table {
        font-size: 0.8rem;
    }

    .alert-table thead th,
    .activity-table thead th,
    .top-products-table thead th {
        padding: 8px 10px;
    }

    .alert-table tbody td,
    .activity-table tbody td,
    .top-products-table tbody td {
        padding: 8px 10px;
    }
}
