/* =========================
   GLOBAL LAYOUT
========================= */
body {
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5 url("https://www.toptal.com/designers/subtlepatterns/uploads/white-waves.png");
    background-size: 600px;
    text-align: center;
    margin: 50px;
}

a { text-decoration: none; color: inherit; }
a:hover { background: #0a58ca; }

/* =========================
   GLOBAL BUTTONS
========================= */
.btn {
    display: inline-block;
    padding: 12px 20px;
    background: #0d6efd;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    transition: 0.2s;
}

.btn:hover {
    background: #0a58ca;
}

/* =========================
   TIP CALCULATOR CARD
========================= */
.the-card {
    width: 100%;
    max-width: 500px;
    padding: 30px;
    border-radius: 10px;
    box-shadow: rgba(0,0,0,0.15) 0 4px 12px;
    background-color: white;
    margin: 40px auto;
    text-align: center;       /* center headings */
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;      /* center all children */
}

/* Center Tip Calculator Form Content */
.the-card form {
    display: flex;
    flex-direction: column;
    align-items: center; /* center everything horizontally */
    gap: 20px;
}

.bill-input,
.tip-input,
.total-display {
    display: flex;
    flex-direction: column;
    align-items: center; /* center label + input / text */
    gap: 8px;
}

.bill-input label,
.tip-input label,
.total-display p {
    text-align: center; /* center text */
}

/* Bill and Tip inputs smaller */
.bill-input input,
.tip-input input {
    width: 200px;         /* narrower box */
    max-width: 80%;       /* responsive on mobile */
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 15px;
}

.tip-presets {
    display: flex;
    gap: 10px;
    justify-content: center;  /* center preset buttons */
    width: 100%;
}

.tip-presets .preset {
    flex: 1;
    padding: 10px 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f8f8f8;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.tip-presets .preset:hover {
    background: #e0e0e0;
}

#calculate {
    width: 80%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: #0d6efd;
    color: white;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
}

#calculate:hover {
    background: #0a58ca;
}

.total-display p {
    margin: 0;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    width: 100%;
    text-align: center;       /* center the text inside p */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .the-card {
        padding: 20px;
        max-width: 90%;
    }

    .tip-presets {
        flex-direction: column;
    }

    .tip-presets .preset {
        width: 100%;
    }
}

/* =========================
   DASHBOARD METRICS
========================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 40px auto;
    max-width: 1200px;
}

.metric-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: rgba(0,0,0,0.08) 0 4px 12px;
    text-align: center;
}

.metric-card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: bold;
}

/* =========================
   BUDGET BAR
========================= */
.budget-bar-container {
    width: 60%;
    margin: 20px auto;
}

.budget-bar {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.expense-bar {
    height: 100%;
    background: #ff4d4d;
    transition: width 0.4s ease;
}

.budget-text {
    margin-top: 10px;
    font-weight: 500;
}

/* =========================
   CATEGORY BREAKDOWN
========================= */
.category-list {
    max-width: 600px;
    margin: 20px auto 40px auto;
}

.category-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
}

/* =========================
   NAVIGATION BUTTONS
========================= */
.center-nav-wrapper, .dashboard-nav-wrapper {
    display: flex;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    padding: 15px 20px;
    border-radius: 12px;
    margin: 25px auto;
    max-width: 400px;
    box-shadow: rgba(0,0,0,0.08) 0 4px 12px;
    gap: 15px;
}

.center-nav-wrapper .btn, .dashboard-nav-wrapper .btn {
    flex: unset;
}

/* =========================
   ADD FORM MODAL
========================= */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 15px;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #000;
}

/* =========================
   FORMS
========================= */
.nice-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nice-form label {
    font-weight: bold;
}

.nice-form input, .nice-form select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
}

/* Modal form spacing */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    font-weight: 600;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 15px;
}

/* Modal action button spacing */
.form-actions {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .budget-bar-container { width: 80%; }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .budget-bar-container { width: 90%; }
    .center-nav-wrapper, .dashboard-nav-wrapper { flex-direction: column; gap: 10px; max-width: 90%; }
    .modal-content { margin: 20% auto; padding: 35px; }
}

@media (max-width: 480px) {
    .the-card { width: 95%; }
}

/* =========================
   CAR MAINTENANCE CARD
========================= */
.car-card {
    width: 95%;
    max-width: 1200px;
    padding: 30px;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* =========================
   CAR MAINTENANCE TABLE
========================= */
.car-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.car-table th,
.car-table td {
    padding: 10px;
    border: 1px solid #ccc;
    vertical-align: top;
}

.car-table th {
    background: #f0f0f0;
}

.car-table td ul {
    margin: 0;
    padding-left: 18px;
    display: inline-block;
    text-align: left;
}

.empty-row {
    text-align: center;
    padding: 15px;
}

/* =========================
   CAR MAINTENANCE ACTION BUTTONS
========================= */
.car-table .actions-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;       /* spacing between buttons */
}

.car-table .actions-cell form {
    display: inline;  /* ensures form doesn't create a new line */
    margin: 0;
}

.car-table .actions-cell .btn {
    display: inline-block;
    width: auto;
    font-size: 14px;
    padding: 8px 14px;
}

/* =========================
   CAR FORM STYLING
========================= */
.car-form {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.car-form input,
.car-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    text-align: center;
}

.car-form textarea {
    resize: vertical;
}

/* =========================
   ADD BUTTON SPACING
========================= */
.add-btn {
    margin-bottom: 15px;
}

/* =========================
   HOME PAGE MENU BUTTONS
========================= */
.menu {
    display: flex;
    flex-direction: column;   /* stack vertically */
    align-items: center;
    gap: 15px;                /* space between buttons */
    margin-top: 20px;
}

.menu .btn {
    width: 220px;             /* uniform width for menu buttons */
    text-align: center;
}