@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;700&display=swap');

/* --- การตั้งค่าพื้นฐานและตัวแปรสี (เหมือนกับ index.html) --- */
:root {
    --primary-blue: #0D2F4B;
    --accent-gold: #D4AF37;
    --light-gray: #f4f7f6;
    --dark-gray: #333333;
    --white: #ffffff;
    --success-green: #28a745;
    --danger-red: #dc3545;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Kanit', sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: var(--light-gray);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- ส่วนของ Navigation Bar --- */
.navbar {
    background-color: var(--white);
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-decoration: none;
}

.user-menu a {
    color: var(--primary-blue);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
}

.user-menu a:hover {
    color: var(--accent-gold);
}

/* --- ส่วน Dashboard หลัก --- */
.dashboard-main {
    padding: 40px 0;
}

.dashboard-main h1 {
    font-size: 2.5rem;
    color: var(--primary-blue);
    margin-bottom: 30px;
}

/* --- การ์ดสรุป --- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.summary-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.summary-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.summary-card-link:hover .summary-item {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(13, 47, 75, 0.1); /* Use primary-blue with alpha */
}

.summary-item h3 {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 400;
    margin-bottom: 10px;
}

.summary-item .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.summary-item .value.profit {
    color: var(--success-green);
}

.summary-item .value.loss {
    color: var(--danger-red);
}

.summary-item .sub-value {
    font-size: 0.9rem;
    color: #6c757d;
}

/* --- Grid Layout สำหรับเนื้อหาหลัก --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.main-content, .sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.card h2 {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* --- แผนการออมของฉัน --- */
#my-plan .progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 5px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar {
    width: 42%; /* ตัวอย่าง: 10/24 งวด */
    height: 100%;
    background-color: var(--accent-gold);
    text-align: center;
    line-height: 20px;
    color: white;
    font-size: 0.8rem;
}

.plan-details-list {
    list-style: none;
    padding: 0;
}

.plan-details-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.plan-details-list li:last-child {
    border-bottom: none;
}

.plan-details-list span {
    color: #6c757d;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: var(--accent-gold);
    color: var(--primary-blue);
    width: 100%;
    margin-top: 20px;
    font-size: 1.1rem;
}

.btn-primary:hover {
    background-color: #c8a02b;
}

/* --- ประวัติธุรกรรม --- */
.transaction-table {
    width: 100%;
    border-collapse: collapse;
}

.transaction-table th, .transaction-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.transaction-table th {
    background-color: var(--light-gray);
    font-weight: 500;
    color: var(--primary-blue);
}

.view-all-link {
    display: block;
    text-align: right;
    margin-top: 15px;
    text-decoration: none;
    color: var(--primary-blue);
    font-weight: 500;
}

/* --- Saving Goals --- */
.goal-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.goal-item {
    margin-bottom: 20px;
}

.goal-item:last-child {
    margin-bottom: 0;
}

.goal-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
}

.goal-name {
    color: var(--primary-blue);
}

.goal-amount {
    color: #6c757d;
    font-size: 0.9rem;
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
    width: 100%;
    margin-top: 10px;
    font-size: 1rem;
}
.btn-secondary:hover {
    background-color: var(--primary-blue);
    color: var(--white);
}

/* --- Sidebar --- */
#gold-price canvas {
    max-height: 250px;
}

.quick-actions-list a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: var(--primary-blue);
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.3s ease;
}
.quick-actions-list a:last-child {
    border-bottom: none;
}
.quick-actions-list a:hover {
    color: var(--accent-gold);
}

/* --- Footer --- */
.footer {
    background-color: var(--primary-blue);
    color: var(--light-gray);
    padding: 40px 0;
    text-align: center;
    margin-top: 40px;
}

/* --- Modal & Form Styles --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-gray);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 47, 75, 0.6); /* Using primary-blue with alpha */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.close-button {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
    line-height: 1;
}

.close-button:hover {
    color: var(--dark-gray);
}

.modal-footer {
    text-align: right;
    margin-top: 30px;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-main h1 {
        font-size: 2rem;
    }
    .summary-item .value {
        font-size: 1.5rem;
    }
}