/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    display: flex;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background-color: #1a1a2e;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

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

.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

.nav-link {
    color: #a0a0b0;
    text-decoration: none;
    padding: 12px 20px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: #2d2d4a;
    color: white;
}

.nav-link.active {
    background-color: #3d3d5c;
    color: white;
}

/* Content area */
.content {
    flex: 1;
    margin-left: 200px;
    padding: 20px;
    min-height: 100vh;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.page-header h1 {
    font-size: 1.8rem;
    color: #1a1a2e;
}

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

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

.card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* Section */
.section {
    margin-bottom: 30px;
}

.section h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #1a1a2e;
}

/* Tables */
.table {
    width: 100%;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.table thead {
    background-color: #1a1a2e;
    color: white;
}

.table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

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

.totals-row {
    background-color: #f0f0f0 !important;
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-stock {
    background-color: #e0f2fe;
    color: #0284c7;
}

.badge-fii {
    background-color: #dcfce7;
    color: #16a34a;
}

.badge-cash {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-buy {
    background-color: #dcfce7;
    color: #16a34a;
}

.badge-sell {
    background-color: #fee2e2;
    color: #dc2626;
}

.badge-dividend {
    background-color: #dbeafe;
    color: #2563eb;
}

.badge-jscp {
    background-color: #f3e8ff;
    color: #9333ea;
}

.badge-interest {
    background-color: #ffedd5;
    color: #ea580c;
}

/* Forms */
.form {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

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

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

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a1a2e;
}

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

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

.btn-primary {
    background-color: #1a1a2e;
    color: white;
}

.btn-primary:hover {
    background-color: #2d2d4a;
}

.btn-secondary {
    background-color: #e5e5e5;
    color: #333;
}

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

.btn-danger {
    background-color: #ef4444;
    color: #fff;
}

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

/* Links in tables */
.table a {
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 500;
}

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

/* Color classes */
.positive {
    color: #10b981;
}

.negative {
    color: #ef4444;
}

/* Live refresh indicator */
.htmx-indicator {
    font-size: 0.7rem;
    color: #6b7280;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
    opacity: 1;
}

#last-updated {
    display: block;
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: -10px;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
        padding: 15px;
    }

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

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

    .table {
        overflow-x: auto;
    }

    .table table {
        min-width: 600px;
    }
}