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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* App Wrapper with Sidebar */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    color: white;
}

.sidebar-nav {
    padding: 10px 0;
    flex: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
    margin-top: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: #34495e;
    color: white;
}

.nav-item.active {
    background-color: #34495e;
    border-left-color: #3498db;
    color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-label {
    font-size: 15px;
}

/* Main Content Area */
.main-content {
    margin-left: 250px;
    flex: 1;
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

header h1 {
    font-size: 28px;
}

/* Filters Section */
.filters-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.filter-with-button {
    display: flex;
    gap: 5px;
    align-items: center;
}

.filter-with-button select {
    flex: 1;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    min-width: auto;
    margin-right: 5px;
}

.btn-small:last-child {
    margin-right: 0;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

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

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

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

/* Table Section */
.table-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.table-header-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.table-header-with-button h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background-color: #34495e;
    color: white;
}

th, td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #666;
    font-size: 14px;
}

th {
    font-weight: 600;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
}

th.sortable:hover {
    background-color: #2c3e50;
}

.sort-indicator {
    position: absolute;
    right: 8px;
    font-size: 10px;
    visibility: hidden;
    color: #3498db;
}

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

.po-row-clickable {
    cursor: pointer;
}

.po-row-clickable:hover {
    background-color: #e8f4f8;
}

.invoice-row-clickable {
    cursor: pointer;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-Open {
    background-color: #3498db;
    color: white;
}

.status-Low {
    background-color: #f39c12;
    color: white;
}

.status-Out {
    background-color: #95a5a6;
    color: white;
}

.status-Over {
    background-color: #e74c3c;
    color: white;
}

.status-Closed {
    background-color: #2c3e50;
    color: white;
}

.status-Active {
    background-color: #27ae60;
    color: white;
}

.status-Archived {
    background-color: #95a5a6;
    color: white;
}

.status-Deleted {
    background-color: #e74c3c;
    color: white;
}

/* Invoice Status Badges */
.invoice-status-Paid {
    background-color: #B5E6A2;
    color: #2c3e50;
}

.invoice-status-Sent {
    background-color: #F7C7AC;
    color: #2c3e50;
}

.invoice-status-Draft {
    background-color: #EFF698;
    color: #2c3e50;
}

.invoice-status-select {
    cursor: pointer;
    background-color: white;
}

.invoice-status-select:focus {
    outline: 2px solid #3498db;
    outline-offset: -2px;
}

/* Invoice row background colors based on status */
.invoice-row-Paid {
    background-color: #B5E6A2;
}

.invoice-row-Sent {
    background-color: #F7C7AC;
}

.invoice-row-Draft {
    background-color: #EFF698;
}

.invoice-row:hover {
    opacity: 0.9;
}

/* Dark gray separators for invoice table */
#invoicesTable th,
#invoicesTable td {
    border-bottom: 1px solid #666;
    padding: 5px 10px;
}

#invoicesTable tbody tr:last-child td {
    border-bottom: none;
}

.action-link {
    color: #3498db;
    text-decoration: none;
    margin-right: 10px;
    cursor: pointer;
}

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

/* Action buttons in table */
td .btn-small {
    margin-right: 5px;
    white-space: nowrap;
}

td .btn-small:last-child {
    margin-right: 0;
}

/* Actions dropdown menu */
.actions-cell {
    position: relative;
    text-align: center;
}

.actions-dots {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    padding: 5px 10px;
    line-height: 1;
    vertical-align: middle;
    transition: color 0.2s;
}

.actions-dots:hover {
    color: #2c3e50;
}

.actions-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
    margin-top: 5px;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.dropdown-item-danger {
    color: #e74c3c !important;
    font-weight: 600;
}

.dropdown-item-danger:hover {
    background-color: #fee;
    color: #c0392b !important;
}

/* PO Details Section */
.po-details-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.details-header h2 {
    color: #2c3e50;
}

.po-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.info-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item strong {
    color: #555;
    font-size: 14px;
}

.section {
    margin-top: 30px;
}

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

.section-header h3 {
    color: #2c3e50;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.total-amount-display {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 2px solid #3498db;
    text-align: center;
}

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

.invoice-line-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
}

.invoice-line-item input[type="checkbox"] {
    width: auto;
}

.invoice-line-item label {
    flex: 1;
    margin: 0;
    font-weight: normal;
}

.invoice-line-item input[type="number"] {
    width: 120px;
    margin: 0;
}

/* Dashboard Styles */
.dashboard-container {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: 32px;
    color: #2c3e50;
    margin: 0;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metrics-grid.secondary {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

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

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.metric-card.small {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
}

.metric-icon {
    font-size: 36px;
    opacity: 0.8;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
    font-weight: 500;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.metric-card.small .metric-value {
    font-size: 20px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.chart-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-card h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.chart-card canvas {
    max-height: 300px;
}

/* Placeholder Section */
.placeholder-section {
    background-color: white;
    padding: 60px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.placeholder-content {
    max-width: 600px;
    margin: 0 auto;
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.placeholder-content h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.placeholder-content p {
    color: #7f8c8d;
    margin-bottom: 10px;
}

.placeholder-features {
    text-align: left;
    display: inline-block;
    margin-top: 20px;
    color: #555;
}

.placeholder-features li {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .filters-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group select {
        width: 100%;
    }
    
    .info-row {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
    }
    
    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .nav-item.active {
        border-left: none;
        border-bottom-color: #3498db;
    }
}

