:root {
    --navy-primary: #002147; /* Deep Navy Blue */
    --navy-light: #003366;   /* Lighter Navy for hover */
    --gold-accent: #D4AF37;  /* Gold matching the logo */
    --white: #ffffff;
    --grey-bg: #f4f6f9;
}

body {
    font-family: 'Sarabun', sans-serif; /* Standard Thai font */
    background-color: var(--grey-bg);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* The Main Card */
.login-container {
    background-color: var(--white);
    width: 100%;
    max-width: 400px; /* Looks like a mobile app */
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Header & Logo */
.logo {
    width: 100px;
    height: auto;
    margin-bottom: 1rem;
}

.portal-title {
    color: var(--navy-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    color: #666;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Form Inputs */
.input-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.input-group label {
    display: block;
    color: var(--navy-primary);
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box; /* Ensures padding doesn't break width */
}

.input-group input:focus {
    border-color: var(--navy-primary);
    outline: none;
}

/* Links */
.actions {
    text-align: right;
    margin-bottom: 1.5rem;
}

/* The Link Styling */
.forgot-link {
    color: var(--navy-light); /* Uses your lighter Navy Blue variable */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.3s;
}

.forgot-link:hover {
    color: var(--gold-accent); /* Turns Gold when hovered */
    text-decoration: underline;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: 0.3s;
}

.btn-primary {
    background-color: var(--navy-primary);
    color: var(--white);
    border: none;
}

.btn-primary:hover {
    background-color: var(--navy-light);
}

.btn-outline {
    background-color: transparent;
    color: var(--navy-primary);
    border: 2px solid var(--navy-primary);
}

.btn-outline:hover {
    background-color: #f0f4f8;
}

/* Footer */
.footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #888;
}

/* --- New Styles for Registration Page --- */

/* 1. Top-Left Header Styling */
.top-left-header {
    position: absolute; /* Fixes it to the top left */
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 15px; /* Space between logo and text */
}

.header-logo {
    width: 60px; /* Smaller than the login page logo */
    height: auto;
}

.header-text h1 {
    color: var(--navy-primary);
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
}

.header-text p {
    color: #666;
    margin: 0;
    font-size: 0.8rem;
}

/* 2. Registration Card Styling */
.register-container {
    background-color: var(--white);
    width: 100%;
    max-width: 450px; /* Slightly wider than login for better readability */
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 80px; /* Pushes it down so it doesn't hit the header on small phones */
}

.form-title {
    color: var(--navy-primary);
    text-align: center;
    margin-top: 0;
}

.form-subtitle {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Responsive adjustment for phones */
@media (max-width: 480px) {
    .top-left-header {
        position: relative; /* On phones, un-fix it so it scrolls naturally */
        top: 0;
        left: 0;
        margin-bottom: 20px;
        justify-content: center; /* Center it on small screens */
    }
    
    .register-container {
        margin-top: 0;
    }
}

/* --- Dashboard Styles --- */

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--white);
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.greeting {
    font-size: 0.8rem;
    color: #888;
    display: block;
}

.user-name {
    color: var(--navy-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.logout-icon {
    background: none;
    border: none;
    color: #d9534f; /* Red for logout */
    font-size: 1.2rem;
    cursor: pointer;
}

.dashboard-container {
    padding: 1.5rem;
    padding-bottom: 100px; /* Space for the scan button */
}

/* Balance Card */
.balance-card {
    background: linear-gradient(135deg, var(--navy-primary), var(--navy-light));
    color: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 33, 71, 0.3);
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

/* Decorative Gold Circle behind text */
.balance-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: rgba(212, 175, 55, 0.1); /* Gold tint */
    border-radius: 50%;
}

.balance-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold-accent);
    margin-bottom: 0.5rem;
}

.balance-id {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.1);
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
}

/* Recent Activity */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title h3 {
    margin: 0;
    color: var(--navy-primary);
    font-size: 1.1rem;
}

.refresh-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-item {
    background: var(--white);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tx-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f8;
    color: var(--navy-primary);
    margin-right: 15px;
}

.tx-details {
    flex-grow: 1;
}

.tx-name {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--navy-primary);
}

.tx-date {
    font-size: 0.75rem;
    color: #888;
}

.tx-amount {
    font-weight: bold;
}
.tx-amount.negative { color: var(--navy-primary); }
.tx-amount.positive { color: #28a745; }

/* Fixed Bottom Button (FAB) */
.fab-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    padding: 1rem;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
    box-sizing: border-box; /* Fix for padding issues */
}

.scan-fab {
    background-color: var(--gold-accent); /* Gold Button stand out against Navy theme */
    color: var(--navy-primary);
    width: 100%;
    max-width: 400px;
    padding: 16px;
    border: none;
    border-radius: 50px; /* Pill shape */
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: transform 0.2s;
}

.scan-fab:active {
    transform: scale(0.98);
}
/* ============================================================== */
/*  RESPONSIVE LAYER                                                */
/*  Phone (≤480px) and tablet (≤768px) breakpoints.                 */
/*  Touch tap targets ≥ 44px, no horizontal scroll, readable type.  */
/* ============================================================== */

/* Form inputs become 16px on mobile so iOS doesn't auto-zoom on focus */
@media (max-width: 768px) {
    body { align-items: flex-start; padding: 1rem 0.5rem; }
    .login-container,
    .register-container {
        max-width: 100%;
        padding: 1.5rem 1rem;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    }
    .portal-title { font-size: 1.25rem; }
    .subtitle { font-size: 0.85rem; }
    .input-group input {
        font-size: 16px; /* prevents iOS zoom-on-focus */
    }
    .btn,
    .btn-primary,
    .btn-outline {
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Phones — extra-small adjustments */
@media (max-width: 380px) {
    .logo { width: 80px; }
    .portal-title { font-size: 1.1rem; }
    .login-container,
    .register-container { padding: 1.25rem 0.75rem; }
}

/* Buyer dashboard responsive */
@media (max-width: 600px) {
    .dashboard-wrap { padding: 0 0.75rem !important; }
    .balance-card { padding: 1.5rem 1rem !important; }
    .balance-amount { font-size: 2.4rem !important; }
    .scan-btn,
    .scan-fab { width: 100% !important; max-width: 100% !important; }
}

/* Make any modal full-screen friendly on phones */
@media (max-width: 480px) {
    [id$="Modal"] > div,
    .modal-card {
        width: calc(100% - 2rem) !important;
        max-width: 100% !important;
        margin: 1rem;
    }
}
