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

body {
    font-family: 'Convergence', sans-serif;
    background-color: #ae9e8d;
    min-height: 100vh;
    padding: 40px;
}

/* Dashboard Container */
.dashboard {
    max-width: 1500px;
    margin: 0 auto;
}

/* Main Title */
.main-title {
    font-family: 'Arial Black', sans-serif;
    font-size: 48px;
    color: #54370c;
    margin-bottom: 30px;
    font-weight: 900;
}

/* Cards Container - Grid Layout */
.cards-container {
    display: grid;
    grid-template-columns: 404px 356px 404px;
    grid-template-rows: auto auto;
    gap: 20px;
}

/* Base Card Styles */
.card {
    background-color: #eeecea;
    border-radius: 10px;
    padding: 15px 20px;
    position: relative;
}

.card-title {
    font-family: 'Convergence', sans-serif;
    font-size: 22px;
    color: #29150c;
    font-weight: 400;
    margin-bottom: 15px;
}

.card-title.light {
    color: #eeecea;
}

/* ============================================
   CARD 1: Weekly Revenue Trend
   ============================================ */
.weekly-revenue {
    height: 100%;
}

.weekly-revenue .chart-container {
    display: flex;
    margin-top: 12px;
    height: 192px;
}

.weekly-revenue .y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 9.4px;
    color: #29150c;
    text-align: right;
    padding-right: 10px;
    width: 40px;
    height: 80%;
}

.weekly-revenue .y-axis span {
    transform: translateY(50%);
}

.weekly-revenue .chart-area {
    flex: 1;
    position: relative;
    border-left: 2px solid #888;
    border-bottom: 2px solid #888;
}

.weekly-revenue .grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 20%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.weekly-revenue .grid-line {
    width: 100%;
    height: 1px;
    background: rgba(136, 136, 136, 0.3);
}

.weekly-revenue .line-chart {
    position: absolute;
    top: 0;
    left: 10px;
    right: 10px;
    bottom: 0;
    width: calc(100% - 20px);
    height: 80%;
}

.weekly-revenue .line {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.weekly-revenue .revenue-line {
    stroke: #b74444;
}

.weekly-revenue .expenses-line {
    stroke: #d8a659;
}

.weekly-revenue .profit-line {
    stroke: #9dd63a;
}

.weekly-revenue .x-axis {
    position: absolute;
    bottom: -24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    font-family: 'Afacad', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #29150c;
    padding: 0 5px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 25px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Afacad', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #29150c;
}

.legend-color {
    width: 12px;
    height: 12px;
}

.legend-color.revenue,
.legend-color.target {
    background-color: #b74444;
}

.legend-color.expenses,
.legend-color.today {
    background-color: #d8a659;
}

.legend-color.profit,
.legend-color.yesterday {
    background-color: #9dd63a;
}

/* ============================================
   CARD 2: Today's Revenue
   ============================================ */
.todays-revenue {
    background-color: #54370c;
    height: 168px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.todays-revenue .card-title {
    margin-bottom: 5px;
}

.revenue-display {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.revenue-display .amount {
    font-family: 'AR One Sans', sans-serif;
    font-weight: 600;
    font-size: 40px;
    color: #eeecea;
}

.revenue-display .percentage {
    font-family: 'AR One Sans', sans-serif;
    font-weight: 600;
    font-size: 32px;
    color: #1ad665;
}

/* ============================================
   CARD 3: Low Stock Alerts
   ============================================ */
.low-stock {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.low-stock .card-title {
    flex-shrink: 0;
}

.stock-list {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    flex: 1;
    margin-top: 5px;
    padding-bottom: 10px;
}

.stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 5px;
}

.stock-divider {
    width: 100%;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #29150c,
        #29150c 4px,
        transparent 4px,
        transparent 10px
    );
}

.stock-item .item-name {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #29150c;
}

.stock-item .status {
    font-family: 'AR One Sans', sans-serif;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    min-width: 65px;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-item .status.critical {
    color: #fff;
    background-color: #e20f0f;
}

.stock-item .status.low {
    color: #fff;
    background-color: #dd7c1b;
}

.stock-item .status.watch {
    color: #fff;
    background-color: #40ca77;
}

/* ============================================
   CARD 4: Product Performance
   ============================================ */
.product-performance {
    height: 313px;
    overflow: hidden;
    padding-bottom: 25px;
}

.bar-chart.horizontal {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 5px;
}

.bar-row {
    display: flex;
    align-items: center;
    height: 28px;
}

.bar-row .bar-label {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #29150c;
    text-align: right;
    min-width: 110px;
    padding-right: 12px;
}

.bar-row .crown-icon {
    font-size: 14px;
    margin-right: 3px;
}

.bar-row .bar-wrapper {
    flex: 1;
    height: 10px;
    background: transparent;
}

.bar-row .bar {
    height: 100%;
    border-radius: 0;
}

/* ============================================
   CARD 5: Daily Financial Overview
   ============================================ */
.daily-financial {
    height: 100%;
}

.vertical-chart-container {
    display: flex;
    height: 300px;
    margin-top: 12px;
}

.y-axis-vertical {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 10px;
    color: #29150c;
    text-align: right;
    padding-right: 8px;
    width: 40px;
    margin-bottom: 35px;
    height: calc(100% - 35px - 16.67%);
}

.y-axis-vertical span {
    transform: translateY(50%);
}

.vertical-chart-area {
    flex: 1;
    position: relative;
    border-left: 2px solid #666;
    border-bottom: 2px solid #666;
    margin-bottom: 35px;
}

.grid-lines-vertical {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 16.67%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.grid-line-h {
    width: 100%;
    height: 1px;
    background: rgba(100, 100, 100, 0.4);
}

.bar-groups {
    position: absolute;
    top: 0;
    left: 10px;
    right: 10px;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 10px;
}

.bar-group {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 100%;
}

.v-bar {
    width: 7px;
}

.v-bar.target {
    background-color: #b74444;
}

.v-bar.today {
    background-color: #d8a659;
}

.v-bar.yesterday {
    background-color: #9dd63a;
}

.x-axis-vertical {
    position: absolute;
    bottom: -35px;
    left: 0;
    right: 0;
    height: 35px;
    display: flex;
    justify-content: space-between;
    padding: 5px 5px 0 5px;
}

.x-label {
    font-family: 'Afacad', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #29150c;
    text-align: center;
    line-height: 1.2;
    flex: 1;
}

.vertical-legend {
    margin-top: 15px;
}

.vertical-legend .legend-color {
    width: 14px;
    height: 14px;
}

/* ============================================
   CARD 6: Payment Methods
   ============================================ */
.payment-methods {
    height: 313px;
    overflow: hidden;
}

.payment-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 0;
}

.donut-chart {
    width: 192px;
    height: 192px;
    flex-shrink: 0;
}

.donut-chart svg {
    width: 100%;
    height: 100%;
}

.donut-segment {
    fill: none;
    stroke-width: 40;
    cursor: pointer;
    transition: opacity 0.3s ease, stroke-width 0.3s ease;
}

.donut-chart:hover .donut-segment {
    opacity: 0.4;
}

.donut-chart:hover .donut-segment:hover {
    opacity: 1;
    stroke-width: 45;
}

.payment-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    opacity: 0.4;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.payment-methods:not(:hover) .payment-item {
    opacity: 1;
}

.payment-item.highlighted {
    opacity: 1;
    transform: translateX(5px);
}

.payment-color {
    width: 15px;
    height: 15px;
}

.payment-color.credit {
    background-color: #b74444;
}

.payment-color.cash {
    background-color: #d8a659;
}

.payment-color.debit {
    background-color: #e9da33;
}

.payment-color.mobile {
    background-color: #83d63a;
}

.payment-color.gift {
    background-color: #18b1a9;
}

.payment-item span {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #29150c;
}

/* ============================================
   Grid Layout Adjustments
   ============================================ */
.cards-container {
    display: grid;
    grid-template-columns: 485px 427px 485px;
    grid-template-rows: 168px 145px 313px;
    gap: 23px;
}

.weekly-revenue {
    grid-column: 1;
    grid-row: 1 / 3;
}

.todays-revenue {
    grid-column: 2;
    grid-row: 1;
}

.low-stock {
    grid-column: 3;
    grid-row: 1 / 3;
}

.product-performance {
    grid-column: 1;
    grid-row: 3;
}

.daily-financial {
    grid-column: 2;
    grid-row: 2 / 4;
}

.payment-methods {
    grid-column: 3;
    grid-row: 3;
}

/* Responsive adjustments */
@media (max-width: 1280px) {
    .cards-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    
    .weekly-revenue,
    .todays-revenue,
    .low-stock,
    .product-performance,
    .daily-financial,
    .payment-methods {
        grid-column: auto;
        grid-row: auto;
    }
    
    .main-title {
        font-size: 36px;
    }
}

@media (max-width: 850px) {
    .cards-container {
        grid-template-columns: 1fr;
    }
    
    .card {
        width: 100%;
        max-width: 450px;
        margin: 0 auto;
    }
    
    .main-title {
        font-size: 28px;
        text-align: center;
    }
    
    body {
        padding: 20px;
    }
}

/* ============================================
   Low Stock Detail Page
   ============================================ */
.detail-page {
    min-height: 100vh;
    padding: 22px 24px;
}

.detail-card {
    background-color: #eeecea;
    border-radius: 22px;
    padding: 30px 50px;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 500px;
}

.detail-title {
    font-family: 'Convergence', sans-serif;
    font-size: 21px;
    color: #29150c;
    font-weight: 400;
    margin-bottom: 20px;
}

.stock-detail-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stock-detail-header {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    align-items: flex-end;
    padding-bottom: 0;
    margin-bottom: 10px;
}

.header-spacer {
    /* Empty space for alignment */
}

.reorder-label {
    font-family: 'Afacad', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #29150c;
    text-align: center;
    position: relative;
    left: 60%;
    transform: translateX(-50%);
}

.header-spacer-right {
    /* Empty space for alignment */
}

.stock-detail-row {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    align-items: center;
    gap: 30px;
}

.stock-divider-horizontal {
    width: 100%;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #29150c,
        #29150c 5px,
        transparent 5px,
        transparent 10px
    );
    margin: 8px 0;
}

.stock-name {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    font-size: 21px;
    color: #29150c;
}

.stock-bar-container {
    position: relative;
    width: 100%;
    height: 41px;
}

.stock-bar {
    width: 100%;
    height: 100%;
    background-color: #d9d9d9;
    border-radius: 5px;
    overflow: visible;
    border: 2px solid #666;
    position: relative;
}

.stock-fill {
    height: 100%;
    border-radius: 3px;
    position: relative;
}

.stock-fill.critical-fill {
    background-color: #e20f0f;
}

.stock-fill.low-fill {
    background-color: #dd7c1b;
}

.stock-fill.watch-fill {
    background-color: #40ca77;
}

.reorder-line {
    position: absolute;
    top: -5px;
    left: 60%;
    width: 3px;
    height: 51px;
    background-color: #29150c;
}

.reorder-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background-color: #29150c;
    border-radius: 50%;
}

.stock-status {
    font-family: 'AR One Sans', sans-serif;
    font-weight: 600;
    font-size: 21px;
    text-align: left;
}

.stock-status.status-critical {
    color: #e20f0f;
}

.stock-status.status-low {
    color: #dd7c1b;
}

.stock-status.status-watch {
    color: #40ca77;
}

.back-button {
    display: inline-block;
    margin-top: 40px;
    font-family: 'Albert Sans', sans-serif;
    font-size: 18px;
    color: #54370c;
    text-decoration: none;
    padding: 12px 24px;
    background-color: rgba(84, 55, 12, 0.1);
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: rgba(84, 55, 12, 0.2);
}

/* Make low-stock card clickable */
.low-stock {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.low-stock:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
