:root {
    --primary-color: #1570EF;
    --primary-dark: #0F5BD3;
    --primary-light: #EBF5FF;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --bg-white: #FFFFFF;
    --bg-gray-50: #F9FAFB;
    --bg-gray-100: #F3F4F6;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

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

/* Utility Classes */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 0.875rem;
}

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

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

.btn-secondary {
    background-color: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-gray-50);
}

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

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

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

.btn-success:hover {
    background-color: #059669;
}

.card {
    background-color: var(--bg-white);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

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

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

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-white);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

.table th {
    background-color: var(--bg-gray-50);
    font-weight: 600;
    color: var(--text-primary);
}

.table tr:hover {
    background-color: var(--bg-gray-50);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background-color: #DCFCE7;
    color: #166534;
}

.status-inactive {
    background-color: #FEE2E2;
    color: #991B1B;
}

.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Filter functionality styles */
.filter-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-white);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: var(--bg-white);
    color: var(--text-primary);
    min-width: 150px;
    transition: border-color 0.2s ease-in-out;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1);
}

.filter-clear {
    background-color: var(--bg-gray-100);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    align-self: flex-end;
}

.filter-clear:hover {
    background-color: var(--bg-gray-50);
    color: var(--text-primary);
}

.filter-results-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: auto;
    align-self: flex-end;
}

/* Position subtable styles */
.positions-subtable-row {
    background-color: #f8f9fa !important;
}

.position-subtable-container {
    overflow-x: auto;
    padding: 15px;
    background-color: #f8f9fa;
    /* border-top: 1px solid #dee2e6; */
}

.position-subtable {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background-color: white;
}

.position-subtable table {
    margin: 0;
    min-width: 400px;
    border-collapse: collapse;
}

.position-subtable thead tr {
    background-color: #007bff !important;
    color: white !important;
}

.position-subtable th {
    padding: 8px 12px;
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.position-subtable td {
    padding: 8px 12px;
    font-size: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    border-left: none;
    border-right: none;
}

.position-subtable tbody tr:last-child td {
    border-bottom: none;
}

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

/* Position button states */
.position-btn {
    transition: all 0.2s ease;
}

.position-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

@media (max-width: 1024px) {
    .account-table th,
    .account-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .account-table .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .account-table .btn svg {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 768px) {
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-results-info {
        margin-left: 0;
        align-self: flex-start;
        margin-top: 0.5rem;
    }
    
    .filter-select {
        min-width: auto;
        width: 100%;
    }
    
    .account-table {
        font-size: 0.75rem;
    }
    
    .filter-container {
        gap: 0.75rem;
    }
    
    .filter-select {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .filter-clear {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .position-subtable-container {
        padding: 10px;
    }
    
    .position-subtable th,
    .position-subtable td {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
}

.text-sm {
    font-size: 12px;
}

.account-table th{
    white-space: nowrap;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.account-table .action-buttons {
    min-width: 160px;
}

/* Improved table scrolling on mobile */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-gray-100);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
