/* --- General & Variables --- */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5f7fa;
    --text-color: #333;
    --light-gray: #e0e6ed;
    --dark-gray: #777;
    --background-color: #ffffff;
    --font-family: 'Inter', 'Noto Sans SC', 'Sarabun', sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding-top: 70px; /* Space for fixed navbar */
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 15px 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: transform 0.3s ease;
}
.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 500;
}

/* --- Buttons --- */
.btn {
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--light-gray);
}
.btn-secondary:hover {
    background-color: #e8ecf1;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* --- Hero Section (Home Page) --- */
.hero {
    background: linear-gradient(to right, #e0e6ed, #f5f7fa);
    padding: 100px 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--dark-gray);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Features Section --- */
.features {
    padding: 80px 0;
}

.features .container {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    text-align: center;
}

.feature-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* --- Auth Pages (Login/Register) --- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    background-color: var(--secondary-color);
}

.auth-container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.auth-header h2 {
    margin-bottom: 10px;
}
.auth-header p {
    color: var(--dark-gray);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}
.form-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    box-sizing: border-box; /* Important for padding */
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}


.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

.auth-footer {
    margin-top: 20px;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* --- Animations --- */
.fade-in {
    animation: fadeIn 1s ease-in-out;
}
.fade-in-delay {
    animation: fadeIn 1s 0.5s ease-in-out both;
}
.slide-in {
    animation: slideIn 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.pulse:hover {
    animation: pulse 1.5s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(74, 144, 226, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 144, 226, 0); }
}


/* --- Footer --- */
.footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
}
/* --- Language Switcher --- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 15px;
    border-left: 1px solid var(--light-gray);
    padding-left: 20px;
}

.lang-switcher a {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 500;
    padding: 5px;
    border-radius: 4px;
}

.lang-switcher a:hover {
    background-color: var(--secondary-color);
}

.lang-switcher a.active {
    color: var(--primary-color);
    font-weight: 700;
}

.lang-switcher span {
    color: var(--light-gray);
}
/* --- Alert Messages --- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.5s ease-in-out;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
/* --- Override for Dashboard Page --- */
body.dashboard-body {
    padding-top: 0;
}

/* --- reCAPTCHA & Mobile Auth Styles --- */

.g-recaptcha-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* ทำให้ reCAPTCHA ย่อขนาดตามหน้าจอที่เล็กลง */
@media (max-width: 420px) {
    .g-recaptcha {
        transform: scale(0.85);
        transform-origin: 0 0;
    }
    .auth-container {
        padding: 20px;
    }
}

/* --- Hide Public Nav Links on Mobile --- */
@media (max-width: 768px) {
    .navbar .nav-links {
        display: none; /* ซ่อนเมนูลิงก์ทั้งหมดในจอมือถือ */
    }
}

/* --- 2. กำหนดสีพื้นหลังให้แต่ละไอคอน (แบบไล่สี Gradient) --- */

/* สำหรับ "แก้ไขสลิป" (สีน้ำเงิน) */
.slip-icon {
    background: linear-gradient(135deg, #007bff, #00c6ff);
}

/* สำหรับ "แก้ไขใบแจ้งความ" (สีชมพู) */
.police-icon {
    background: linear-gradient(135deg, #d43f8d, #ff7eb3);
}

/* สำหรับ "แก้ไขใบฟ้องทนาย" (สีม่วง-น้ำเงิน) */
.lawyer-icon {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
}

/* สำหรับ "ค้นที่อยู่จากเบอร์" (สีเขียว) */
.search-icon {
    background: linear-gradient(135deg, #18f192, #25e0e0);
}

/* สำหรับไอคอนอื่นๆ ที่เหลือ สามารถใช้ชุดสีเหล่านี้ได้ครับ */

.memo-icon {
    background: linear-gradient(135deg, #f39c12, #f1c40f); /* สีส้ม-เหลือง */
}

.app-icon {
    background: linear-gradient(135deg, #3498db, #5dade2); /* สีฟ้า */
}

.notification-icon {
    background: linear-gradient(135deg, #e74c3c, #f1948a); /* สีแดง-ส้ม */
}

.wisdom-icon {
    background: linear-gradient(135deg, #8e44ad, #af7ac5); /* สีม่วง */
}

.id-card-icon {
    background: linear-gradient(135deg, #34495e, #5d6d7e); /* สีกรมท่า-เทา */
}

.sme-icon {
    background: linear-gradient(135deg, #27ae60, #2ecc71); /* สีเขียว */
}

/* =============================================== */
/* CSS สำหรับหน้าเลือกรูปแบบ (Choice Grid)        */
/* =============================================== */

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.choice-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.choice-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.choice-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: #fff;
}

.choice-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 500;
}

/* --- กำหนดสีไอคอน --- */
.kbank-icon {
    background-color: #00A950; /* สีเขียวกสิกร */
}

.ktb-icon {
    background-color: #00AEEF; /* สีฟ้ากรุงไทย */
}

.ttb-icon {
    background-color: #0076F3; /* สีน้ำเงินทหารไทยธนชาต */
}

@media (max-width: 992px) {
    /* โค้ดนี้อาจมีอยู่แล้ว แต่ถ้าไม่มีให้ใส่ไปด้วย
       เพื่อเปลี่ยนให้เป็น 1 คอลัมน์บนจอแท็บเล็ตและมือถือ */
    .slip-editor-wrapper {
        grid-template-columns: 1fr;
    }

    /* หัวใจสำคัญของการแก้ไข: 
      สั่งให้ตัวสลิป (canvas) ปรับขนาดให้พอดีกับหน้าจอเสมอ
    */
    #slipCanvas {
        width: 100% !important;  /* ใช้ !important เพื่อ override ค่า width ที่ติดมากับ HTML */
        height: auto !important; /* รักษาสัดส่วนของสลิป */
    }
}