/* ==================== ROOT VARIABLES ==================== */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --purple: #8b5cf6;

    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;

    --sidebar-width: 260px;
    --header-height: 70px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* ==================== LOADING SPINNER ==================== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

.spinner-lg {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

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

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* Loading overlay for data fetching */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

.loading-overlay .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    color: var(--primary);
}

/* ==================== CONFIRMATION MODAL ==================== */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal.show {
    opacity: 1;
    visibility: visible;
}

.confirm-modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.confirm-modal.show .confirm-modal-content {
    transform: scale(1);
}

.confirm-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
}

.confirm-modal-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.confirm-modal-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.confirm-modal-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.confirm-modal h3 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 18px;
    color: var(--text-primary);
}

.confirm-modal p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-actions .btn {
    min-width: 100px;
    padding: 10px 20px;
}

/* ==================== FORM UTILITIES ==================== */
.form-container-sm {
    max-width: 500px;
    margin: 0 auto;
}

.form-container-md {
    max-width: 700px;
    margin: 0 auto;
}

.form-container-lg {
    max-width: 900px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group label i {
    margin-right: 6px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.form-actions-left {
    justify-content: flex-start;
}

.form-actions-center {
    justify-content: center;
}

/* Card Utilities */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
}

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

.card-header h3 i {
    margin-right: 8px;
    color: var(--primary);
}

.card-body {
    padding: 1.5rem;
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

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

.login-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin: 10px 0;
}

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

.login-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ==================== APP LAYOUT ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== LEFT PANEL (SIDEBAR) ==================== */
.left-panel {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-header i {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 8px;
}

.sidebar-header h2 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    margin: 4px 0;
}

.nav-item i {
    font-size: 18px;
    margin-right: 12px;
    width: 24px;
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--primary);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.user-info i {
    font-size: 24px;
    color: var(--primary);
    margin-right: 10px;
}

.user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

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

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--danger);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #dc2626;
}

.logout-btn i {
    margin-right: 8px;
}

/* ==================== RIGHT PANEL (CONTENT) ==================== */
.right-panel {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 28px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alerts-container {
    margin-bottom: 20px;
}

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

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

.alert.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert.danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.undo-link {
    margin-left: auto;
    padding: 6px 12px;
    background: white;
    color: var(--warning);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s;
}

.undo-link:hover {
    background: var(--warning);
    color: white;
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

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

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

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

.btn-icon {
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #f1f5f9;
}

.btn-icon.btn-edit:hover {
    background: #dbeafe;
    color: var(--primary);
}

.btn-icon.btn-delete:hover {
    background: #fee2e2;
    color: var(--danger);
}

.btn-icon.btn-primary {
    color: var(--primary);
}

.btn-icon.btn-success {
    color: var(--success);
}

/* ==================== SEARCH ==================== */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 45px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== TABLES ==================== */
.table-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

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

.modern-table thead {
    background: #f8fafc;
}

.modern-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.modern-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.modern-table tbody tr {
    transition: all 0.3s;
    cursor: pointer;
}

.modern-table tbody tr:hover {
    background: #f8fafc;
}

.modern-table .actions {
    display: flex;
    gap: 8px;
}

.low-stock {
    color: var(--danger);
    font-weight: 600;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.required {
    color: var(--danger);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
}

/* When modal is shown via display:block or display:flex */
.modal.show,
.modal[style*="display: block"],
.modal[style*="display:block"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

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

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin: auto;
}

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

.modal-xl {
    max-width: 1100px;
}

.modal-small {
    max-width: 450px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    font-size: 20px;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--primary);
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--danger);
    background: #fee2e2;
}

.modal-body {
    padding: 24px;
}

.modal-content form {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
    position: sticky;
    bottom: 0;
}

.details-content {
    padding: 24px;
}

/* Detail View Modal Styles */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.detail-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-section-title i {
    color: var(--primary);
}

/* View Modal specific */
.view-modal .modal-header {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.view-modal .modal-header h2 i {
    color: var(--primary);
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid;
    transition: all 0.3s;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stats-card i {
    font-size: 36px;
    opacity: 0.9;
}

.stats-card.primary {
    border-color: var(--primary);
}

.stats-card.primary i {
    color: var(--primary);
}

.stats-card.success {
    border-color: var(--success);
}

.stats-card.success i {
    color: var(--success);
}

.stats-card.danger {
    border-color: var(--danger);
}

.stats-card.danger i {
    color: var(--danger);
}

.stats-card.warning {
    border-color: var(--warning);
}

.stats-card.warning i {
    color: var(--warning);
}

.stats-card.info {
    border-color: var(--info);
}

.stats-card.info i {
    color: var(--info);
}

.stats-card.purple {
    border-color: var(--purple);
}

.stats-card.purple i {
    color: var(--purple);
}

.stats-content h3 {
    font-size: 32px;
    margin: 0;
    color: var(--text-primary);
}

.stats-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== CHARTS ==================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

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

.chart-card h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-primary);
}

.chart-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: -8px;
    margin-bottom: 16px;
}

/* ==================== FILE INPUT STYLING ==================== */
.file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-input:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.file-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.current-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 14px;
}

.current-file i {
    color: var(--primary);
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ==================== ACTIVITY CARD ==================== */
.activity-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.activity-card h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-primary);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
}

.empty-state i {
    font-size: 64px;
    color: var(--success);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
}

/* ==================== FILTERS ==================== */
.filter-bar {
    display: flex;
    gap: 16px;
    align-items: end;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    flex: 1;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

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

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.quick-actions h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.action-grid {
    display: flex;
    gap: 16px;
    align-items: end;
}

.action-item {
    flex: 1;
}

.action-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.action-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* ==================== TRANSACTION INFO ==================== */
.txn-info {
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.txn-info p {
    margin: 8px 0;
    color: var(--text-primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .left-panel {
        width: 200px;
    }

    .right-panel {
        margin-left: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-wrap: wrap;
    }

    .action-grid {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .app-container {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        position: relative;
        height: auto;
    }

    .right-panel {
        margin-left: 0;
    }

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

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* ==================== MY BINS DASHBOARD WIDGET ==================== */
.my-bins-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.my-bins-section h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.my-bins-section h3 i {
    color: var(--primary);
}

.bins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.bin-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.bin-card:hover {
    border-color: var(--primary);
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bin-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bin-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bin-info strong {
    color: var(--text-primary);
    font-size: 15px;
}

.bin-path {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bin-count {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
}

.bin-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--secondary);
    color: white;
}

.bin-type-badge.personal {
    background: #ec4899;
}

.bin-type-badge.project {
    background: #8b5cf6;
}

.bin-type-badge.station {
    background: #f59e0b;
}

.recent-transfers {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.recent-transfers h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.transfer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.transfer-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.transfer-list li:last-child {
    border-bottom: none;
}

.transfer-date {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 80px;
}

.transfer-detail {
    color: var(--text-primary);
}

/* ==================== Notification Bell ==================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-bell {
    position: relative;
}

.bell-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    position: relative;
    color: var(--text-secondary);
    font-size: 18px;
    border-radius: 8px;
    transition: all 0.2s;
}

.bell-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: 8px;
    overflow: hidden;
}

.notification-dropdown.show {
    display: block;
}

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

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
}

.mark-all-read:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.notification-item:hover {
    background: var(--bg-secondary);
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-item.unread:hover {
    background: #dbeafe;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.low-stock {
    background: #fef3c7;
    color: #b45309;
}

.notification-icon.out-of-stock {
    background: #fee2e2;
    color: #dc2626;
}

.notification-icon.system {
    background: #e0f2fe;
    color: #0284c7;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.notification-dismiss {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.notification-item:hover .notification-dismiss {
    opacity: 1;
}

.notification-dismiss:hover {
    color: var(--danger);
}

/* ==================== ENHANCED UI COMPONENTS ==================== */

/* Better Button Variants */
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

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

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Card Components */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

/* Status Badges - Enhanced */
.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.badge-purple {
    background: #ede9fe;
    color: #6b21a8;
}

.badge-lg {
    padding: 6px 16px;
    font-size: 14px;
}

/* Order Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-draft {
    background: #f1f5f9;
    color: #475569;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-confirmed, .status-placed {
    background: #dbeafe;
    color: #1e40af;
}

.status-processing, .status-received {
    background: #e0e7ff;
    color: #3730a3;
}

.status-shipped {
    background: #cffafe;
    color: #0e7490;
}

.status-completed, .status-complete {
    background: #d1fae5;
    color: #065f46;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

/* Priority Badges */
.priority-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-low {
    background: #f1f5f9;
    color: #64748b;
}

.priority-normal {
    background: #dbeafe;
    color: #2563eb;
}

.priority-high {
    background: #fef3c7;
    color: #d97706;
}

.priority-urgent {
    background: #fee2e2;
    color: #dc2626;
}

/* Info Box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #eff6ff;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    margin-bottom: 20px;
}

.info-box i {
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box-content {
    flex: 1;
}

.info-box-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.info-box-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 4px;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.success {
    background: var(--success);
}

.progress-fill.warning {
    background: var(--warning);
}

.progress-fill.danger {
    background: var(--danger);
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 22px;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #1e293b;
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 100;
    margin-bottom: 8px;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.divider-text:before,
.divider-text:after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* Data Display */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.data-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Amount Display */
.amount {
    font-family: 'SF Mono', 'Monaco', monospace;
    font-weight: 600;
}

.amount-lg {
    font-size: 24px;
}

.amount-positive {
    color: var(--success);
}

.amount-negative {
    color: var(--danger);
}

/* Form Sections */
.form-section {
    margin-bottom: 32px;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i {
    color: var(--primary);
}

/* Improved Table Styles */
.modern-table tbody tr:last-child td {
    border-bottom: none;
}

.modern-table .text-right {
    text-align: right;
}

.modern-table .text-center {
    text-align: center;
}

.modern-table .compact td {
    padding: 10px 16px;
}

/* Clickable Row Highlight */
.modern-table tbody tr.clickable {
    cursor: pointer;
}

.modern-table tbody tr.clickable:hover {
    background: #eff6ff;
}

/* Action Column */
.modern-table .col-actions {
    width: 120px;
    text-align: right;
}

/* Empty Table State */
.table-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.table-empty i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
}

/* Summary Box */
.summary-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.summary-row.total {
    border-top: 2px solid var(--border);
    margin-top: 12px;
    padding-top: 16px;
    font-size: 18px;
    font-weight: 700;
}

/* Address Block */
.address-block {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
}

.address-block strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline:before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -26px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-content {
    padding: 4px 0;
}

.timeline-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modal Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #e2e8f0;
}

/* Print Styles */
@media print {
    .left-panel,
    .btn,
    .actions,
    .modal {
        display: none !important;
    }

    .right-panel {
        margin-left: 0;
        padding: 0;
    }

    .table-container {
        box-shadow: none;
    }
}

/* ==================== PAGINATION ==================== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    cursor: pointer;
}

.page-link:hover:not(.disabled):not(.active) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.page-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-secondary);
}

.page-ellipsis {
    color: var(--text-secondary);
    padding: 0 8px;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 12px;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}
