*{
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    box-sizing: border-box;
    margin: 0px;
}


header {
    text-align: center;
    color: #1B3C53;
    background-color: #CBDCEB;
    position: relative;
    padding: 15px;
}

.nav-bar{
    margin-top: 1rem;
}

.nav-toggle{
    display: none;
    background: none;
    border: 2px solid #1B3C53;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.2rem;
    color: #1B3C53;
    margin: 0px auto;
}

.nav-toggle:hover,
.nav-toggle:focus{
    background-color: rgba(225, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(27, 60, 83, 0.3);
}

.nav-menu{
    display: flex;
    justify-content: center;
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}

.nav-link{
    text-decoration: none;
    color: #1B3C53;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link:focus{
    background-color: rgba(225, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(27, 60, 83, 0.3);
}

.nav-link.active{
    background-color:#1B3C53 ;
    color: white;
}

.page-section{
    padding: 1rem;
    min-height: 60vh;
}

.skip-link{
    position: absolute;
    top: -40px;
    left: 6px;
    background: #1B3C53;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: 500;
}

.screen-reader{
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
}

.hidden{
    display: none !important;
}

.active{
    display: block;
}

.analytics-container{
    margin-top: 20px;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    align-items: center;

}

#total_no_of_transactions{
    background-color: #A4CCD9;
    width: 150px;
    height: 150px;
    text-align: center;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;
}



#total_spend{
    background-color: #A4CCD9;
    width: 150px;
    height: 150px;
    text-align: center;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;

}


#top_category{
    background-color: #A4CCD9;
    width: 150px;
    height: 150px;
    text-align: center;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;

}


#last_seven_days{
    background-color: #A4CCD9;
    width: 150px;
    height: 150px;
    text-align: center;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;

}

#monthly_budget{
    background-color: #A4CCD9;
    width: 150px;
    height: 150px;
    text-align: center;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;

}

#recent_transactions{
    background-color: rgb(31, 162, 228);
    width: 150px;
    height: 150px;
    text-align: center;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;
}

#total_no_of_transactions:hover,
#total_spend:hover,
#top_category:hover,
#last_seven_days:hover,
#monthly_budget:hover,
#recent_transactions:hover{
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    opacity: 0.9;
}

.nav-link:focus,
.submit-btn:focus,
.nav-toggle:focus{
    outline: 2px solid #1B3C53;
    outline-offset: 2px;
}

/*TABLE STYLING*/
.secondary-btn{
    background-color: #687178;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin: 0 5px;
    transition: background-color 0.3s ease;
}

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

.import-export-controls{
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    align-items: center;
}

.table-controls{
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.transactions-table{
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.transactions-table th,
.transactions-table td{
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.transactions-table th{
    position: relative;
    padding-right: 25px !important;
    transition: background-color 0.3s ease;
}

.transactions-table th:hover{
    background-color: #e9ecef !important;
}

.search-highlight{
    background-color: #ffeb3b;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: bold;
    color: #000;
}

.search-container{
    position: relative;
    margin: 1rem 0;
}

.search-container input{
    width: 100%;
    padding:10px 40px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-container::after{
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666
}

.search-container input::placeholder{
    color: #999;
    font-size: 0.9rem;
}
/*FORM STYLING*/
.form-group{
    margin-bottom: 1.5rem ;
}

.form-group label{
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select{
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:valid,
.form-group select:valid{
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(201, 49, 65, 0.1);
}

/* .form-group input:invalid,
.form-group select:invalid{
    border-color: lightcoral;
} */

.submit-btn{
    background-color: #1B3C53;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.submit-btn:hover{
    background-color: #152a3a;
}

/*CARD VIEW STYLES*/
.cards-container{
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.transaction-card{
    margin-top: 20px;
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #1B3C53;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.transaction-card:hover{
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.card-amount{
    font-size: 1.5rem;
    font-weight: bold;
    color: #1B3C53;
    margin: 0.5rem 0;
}

.card-category, .card-date{
    color: #666;
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.card-actions{
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}
.error-message{
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

#settings, #about{
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}


#about p{
    margin-top: 40px;
    margin-bottom: 1rem;
    line-height: 1.6;
    text-align: left;
    display: flex;
    align-items: center;
}

#card-view h2,
#add-form h2,
#table h2,
#settings h2,
#about{
    text-align: center;
    margin-bottom: 20px;
}
.stat-card{
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover{
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.stat-value{
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.budget-remaining{
    font-size: 0.875rem;
    color: #666;
}

/*CHART STYLING*/
.simple-chart{
    text-align: center;
    margin-top: 0.5rem;
}

.chart-bars{
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 60px;
    gap: 4px;
    margin-bottom: 0.5rem;
}

.chart-bar{
    flex: 1;
    background: linear-gradient(to top, #1B3C53, #3498db) ;
    border-radius: 3px 3px 0 0;
    min-height: 3px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chart-bar:hover{
    opacity: 0.8;
    transform: scaleY(1.05);
}

.chart-summary{
    font-size: 0.9rem;
    color: #1B3C53;
    line-height: 1.4;
}

.chart-summary small {
    color: #666;
    font-size: 0.8rem;
    font-weight: normal;
}

#last_seven_days .stat-value{
    padding: 0.5rem 0;
}
/*MOBILE DEVICES STYLING*/
@media screen and (max-width: 767px){
    .nav-toggle{
        display: block;
    }

    .nav-menu{
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        background: white;
        position: static;
        padding: 1rem;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    .nav-menu.active{
        display: flex;
        animation: slideDown 0.3s ease;
    }

    #total_no_of_transactions, #recent_transactions, #monthly_budget,
    #last_seven_days, #top_category, #total_spend{
        width: 100%;
    }

    .card-container{
        grid-template-columns: 1fr;
    }

    .analytics-container{
        flex-direction: column;
    }

    .page-section{
        padding: 0.5rem;
        /* font-size: 20px; */
    }

    .transactions-table{
        border: 0;
        width: 100%;
        table-layout: fixed;
    }

    .transactions-table thead{
        display: table-header-group;
    }

    .transactions-table tr{
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid #ddd;
        border-radius: 6px;
        padding: 0.75rem;
        background: white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        overflow: hidden;
        max-width: 100%;
    }

    .transactions-table th{
        padding: 10px 2px;
        font-size: 0.7rem;
        text-align: center;
        cursor: pointer;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        background: #f8f9fa;
        border-bottom: 2px solid #dee2e6;
        max-width: 100px;
    }

    .transactions-table th::after{
        font-size: 0.7em;
        right: 1px;
    }


    .transactions-table td{
        display: flex;
        justify-content: space-between;
        padding: 0.4rem 0;
        border-bottom: 1px solid #eee;
        text-align: right;
        align-items: center;
        word-break: break-word;
        max-width: 100%;
    }

    .transactions-table td:last-child{
        border-bottom: none;
        justify-content: center;
        gap: 0.25rem;
        padding-top: 0.5rem;

    }

    .transactions-table td::before{
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        margin-right: 0.25rem;
        color: #1B3C53;
        flex-shrink: 0;
        width: 70px;
        font-size: 0.8rem;
    }

    .transactions-table td:last-child::before{
        content: "";
        display: none;
    }

    .edit-btn, .delete-btn{
        padding: 5px 8px;
        font-size: 0.9rem;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .edit-btn{
        background: #1B3C53;
        color: white;
    }

    .edit-btn:hover{
        background: #152a3a;
    }

    .delete-btn{
        background: #dc3545;
        color: white;
    }

    .delete-btn:hover{
        background: #c82333;
    }

    .chart-bars {
        height: 50px;
        gap: 2px;
    }

    .chart-bar{
        min-width: 8px;
    }

    .chart-summary{
        font-size: 0.8rem;
    }

}

/*TABLET STYLING*/
@media screen and (min-width: 768px) and (max-width: 1023px){
    .analytics-container{
        grid-template-columns: repeat(2, 1fr);
        display: grid;
        gap: 1rem;
        max-width: 1200px;
        margin: 20px auto;
    }

    #total_no_of_transactions, #recent_transactions, #monthly_budget,
    #last_seven_days, #top_category, #total_spend{
        width: 100%;
        height: 200px;
    }

    .nav-toggle{
        display: none;
    }

    .nav-menu{
        display: flex !important;
    }

    @keyframes slideDown{
        from{
            opacity: 0;
            transform: translateY(-10px);
        }to{
            opacity: 1;
            transform: translateY(0);
        }
    }
}


/*DESKTOP DEVICES STYLING*/
@media screen and (min-width: 1024px){
    .analytics-container{
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        max-width: 1200px;
        margin: 20px auto;
    }

    #total_no_of_transactions, #recent_transactions, #monthly_budget,
    #last_seven_days, #top_category, #total_spend{
        width: 100%;
        height: 200px;
    }

    .nav-toggle{
        display: none;
    }

    .nav-menu{
        display: flex !important;
    }

}
