@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body { font-family: 'Inter', sans-serif; background-color: #f3f4f6; color: #1f2937; margin: 0; padding: 1rem; }
.container {
    max-width: 90%; /* CHANGED from 1200px/1000px to 98% */
    margin: 0 auto;
    padding: 0 1rem;
}
.card { background-color: white; border-radius: 0.75rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); padding: 2rem; margin-top: 2rem; }
.view-header { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #e5e7eb; }
.view-header h1 { font-size: 1.875rem; font-weight: 700; margin: 0; }
.view-header p { color: #6b7280; margin-top: 0.5rem; }

/* Login Form Styles */
.login-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 380px; margin: 1rem auto 0; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-weight: 500; margin-bottom: 0.5rem; color: #374151; }
.form-group input { padding: 0.75rem 1rem; border: 1px solid #d1d5db; border-radius: 0.375rem; font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }
.submit-button { background-color: #1f2937; color: white; font-weight: 600; padding: 0.75rem; border: none; border-radius: 0.375rem; font-size: 1rem; cursor: pointer; transition: background-color 0.2s; }
.submit-button:hover { background-color: #374151; }

/* Transaction List & Detail Styles */
.transaction-list { display: flex; flex-direction: column; gap: 0.75rem; }
.transaction-item { width: 100%; text-align: left; padding: 1rem; background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
.transaction-item:hover { background-color: #eff6ff; border-color: #93c5fd; }
.transaction-id { font-family: monospace; font-size: 0.875rem; color: #4b5563; word-break: break-all; }
.platform-badge { color: white; font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.5rem; border-radius: 9999px; margin-left: 1rem; }
.badge-ios { background-color: #374151; }
.badge-android { background-color: #16a34a; }
.detail-header { display: flex; align-items: center; justify-content: space-between; }
.detail-header h1 { font-size: 1.5rem; }
.back-button { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: #2563eb; background: none; border: none; cursor: pointer; font-size: 1rem; }
.back-button svg { width: 1.25rem; height: 1.25rem; }
.back-button:hover { color: #1d4ed8; }
.details-content { margin-top: 2rem; }
.detail-card { background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 1.5rem; }
.detail-card h2 { font-size: 1.25rem; font-weight: 600; color: #374151; margin-top: 0; margin-bottom: 1rem; }
.detail-card pre { background-color: #f3f4f6; padding: 1rem; border-radius: 0.375rem; overflow-x: auto; font-size: 0.875rem; }
.sign-out-button { background: none; border: 1px solid #d1d5db; color: #4b5563; font-weight: 600; padding: 0.5rem 1rem; border-radius: 0.375rem; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
.sign-out-button:hover { background-color: #f3f4f6; border-color: #9ca3af; }

/* NEW: Top Info Grid & Cards */
.top-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.info-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
}
.info-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}
.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}
.info-item-label {
    color: #6b7280;
    font-weight: 500;
}
.info-item-value {
    color: #1f2937;
    font-weight: 600;
    text-align: right;
}
.info-item-value.mono {
    font-family: monospace;
}

/* Utility Classes */
.hidden { display: none !important; }
.status-area { margin: 2rem 0; text-align: center; }
.spinner { border: 4px solid rgba(0, 0, 0, 0.1); width: 36px; height: 36px; border-radius: 50%; border-left-color: #3b82f6; animation: spin 1s ease-infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { color: #ef4444; font-weight: 500; margin-top: 1rem; text-align: center; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}
.filter-group select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    font-size: 1rem;
}
.load-more-container {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}
.transaction-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
}
.transaction-meta {
    font-size: 0.8rem;
    color: #6b7280;
}
.transaction-tags {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.product-badge {
    background-color: #e5e7eb; /* Light gray background */
    color: #1f2937;           /* Dark text color */
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column */
    gap: 2rem;
    margin-top: 1.5rem;
}
/* On wider screens, switch to two columns */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr 2fr; /* Doughnut chart is smaller */
    }
}

canvas {
    display: block;
}

.chart-container {
    /* 1. Use Flexbox to manage the Title + Chart stack */
    display: flex;
    flex-direction: column;

    /* 2. Increase height to accommodate Title + Legend + Chart */
    height: 420px;

    position: relative;
    width: 100%;
    overflow: hidden;
    margin-bottom: 2rem;

    /* Optional: Add background to match other cards */
    background-color: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    padding: 1rem; /* Internal breathing room */
}

/* 3. Force the canvas to fit the remaining flex space */
.chart-container canvas {
    /*flex-grow: 1;    !* Fill whatever space is left after the H3 *!*/
    min-height: 0;   /* Crucial for flex containers to allow shrinking */
    width: 100% !important;
}

.chart-container h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.5rem; /* Small gap between title and chart */
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    flex-shrink: 0; /* Prevent title from getting squashed */
}
