/* Expense Diary v0.6 */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Arial,Helvetica,sans-serif;
}

body{
    background:#f4f6f9;
    padding:25px;
}

.container{
    max-width:1200px;
    margin:auto;
}

header{
    text-align:center;
    margin-bottom:25px;
}

header h1{
    color:#1565c0;
    margin-bottom:8px;
}

.month-box{
    text-align:center;
    margin-bottom:25px;
}

.month-box label{
    display:block;
    margin-bottom:8px;
    font-weight:bold;
}

.month-box select{
    width:250px;
    padding:10px;
    border-radius:8px;
}

.summary{
    display:flex;
    gap:20px;
    margin-bottom:30px;
}

.card{
    flex:1;
    background:#fff;
    padding:20px;
    border-radius:12px;
    box-shadow:0 3px 10px rgba(0,0,0,.08);
}

.card h3{
    margin-bottom:10px;
}

.card h2{
    color:#1565c0;
    margin-bottom:15px;
}

.card input,
.card button{
    width:100%;
}

input,select{
    width:100%;
    padding:10px;
    border:1px solid #ccc;
    border-radius:8px;
}

button{
    margin-top:10px;
    padding:12px;
    background:#1565c0;
    color:white;
    border:none;
    border-radius:8px;
    cursor:pointer;
}

button:hover{
    background:#0d47a1;
}

.expense-form,
.transaction-section,
.calendar-section{
    background:#fff;
    padding:25px;
    margin-top:30px;
    border-radius:12px;
    box-shadow:0 3px 10px rgba(0,0,0,.08);
}

.expense-form h2,
.transaction-section h2,
.calendar-section h2{
    color:#1565c0;
    margin-bottom:20px;
}

.row{
    display:flex;
    gap:20px;
    margin-bottom:15px;
}

.field{
    flex:1;
}

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

th{
    background:#1565c0;
    color:#fff;
    padding:10px;
}

td{
    padding:10px;
    text-align:center;
    border-bottom:1px solid #ddd;
}

/* Calendar Grid */
#calendar{
    display:grid;
    grid-template-columns:repeat(7,1fr);
    gap:10px;
}

.calendar-day{
    min-height:90px;
    border:1px solid #ddd;
    border-radius:8px;
    padding:8px;
    background:#fafafa;
}

.calendar-day .date{
    font-weight:bold;
}

.calendar-day {
    cursor: pointer;
}

.calendar-day .amount{
    color:#1565c0;
    margin-top:8px;
    font-size:14px;
}

@media(max-width:768px){
    .summary,
    .row{
        flex-direction:column;
    }

    #calendar{
        grid-template-columns:repeat(2,1fr);
    }
}

#resetMonthButton{

    width:250px;

    background:#d32f2f;

    color:white;

    border:none;

    padding:12px;

    border-radius:8px;

    cursor:pointer;

}

#resetMonthButton:hover{

    background:#b71c1c;

}

/* ---------- Previous Month Comparison ---------- */

.comparison-section{

    margin:20px 0;

    padding:15px;

    background:#e8f5e9;

    border-left:6px solid #4caf50;

    border-radius:8px;

    font-size:18px;

    font-weight:bold;

}

#comparisonText{

    color:#2e7d32;

}

footer{

    margin-top:40px;

    text-align:center;

    color:#777;

    font-size:14px;

    padding:15px;

}

.transaction-controls {
    display: flex;
    gap: 10px;
    margin: 10px 0 15px;
    flex-wrap: wrap;
}

.transaction-controls select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

.calendar-day .amount {
    color: #e65100 !important;
    font-weight: 700;
    font-size: 13px;
    margin-top: 8px;
}

.calendar-day .expense-amount {
    color: #e65100 !important;
    font-weight: 700;
    font-size: 13px;
}

.calendar-day .zero-amount {
    color: #1565c0 !important;
    font-weight: 600;
    font-size: 13px;
}

.calendar-details {
    margin-top: 15px;
    padding: 15px;
    border-radius: 10px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    display: none;
}

.calendar-details h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.calendar-detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

.calendar-detail-total {
    text-align: right;
    font-weight: bold;
    margin-top: 12px;
    font-size: 16px;
}

.calendar-details {
    margin-top: 15px;
    padding: 15px;
    border-radius: 12px;
    background: #eef5ff;
    border: 1px solid #90caf9;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.calendar-details h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #1565c0;
    font-size: 17px;
}

.calendar-detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 9px 5px;
    border-bottom: 1px solid #c5d8ee;
    font-size: 14px;
}

.calendar-detail-row span:nth-child(1) {
    color: #1565c0;
    font-weight: 600;
}

.calendar-detail-row span:nth-child(2) {
    color: #555;
}

.calendar-detail-row span:nth-child(3) {
    color: #e65100;
    font-weight: 700;
    text-align: right;
}

.calendar-detail-total {
    text-align: right;
    margin-top: 12px;
    color: #c62828;
    font-weight: 700;
    font-size: 16px;
}

.chart-section {
    margin-top: 25px;
}

#expensePieChart {
    display: block;
    width: 100% !important;
    max-width: 320px !important;
    height: 320px !important;
    margin: 0 auto;
}

.calendar-hint {
    text-align: center;
    color: #666;
    font-size: 13px;
    margin: -5px 0 12px;
}