/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Sarabun", sans-serif;
    background-color: #f9fafb;
    /* bg-gray-50 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Custom Calendar Icon Color */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(30%) sepia(70%) saturate(400%) hue-rotate(100deg);
}

/* Header Section */
.main-header {
    background: linear-gradient(to right, #16a34a, #047857);
    /* bg-gradient-to-r from-green-600 to-emerald-700 */
    color: #ffffff;
    text-align: center;
    padding-top: 2rem;
    padding-bottom: 2rem;
    padding-left: 1rem;
    padding-right: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.header-container {
    max-width: 56rem;
    /* max-w-4xl */
    margin-left: auto;
    margin-right: auto;
}

.header-title {
    font-size: 1.5rem;
    /* text-2xl */
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 0.025em;
}

.header-title i {
    margin-right: 0.5rem;
}

.header-subtitle {
    color: #dcfce7;
    /* text-green-100 */
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 300;
}

/* Main Layout */
.main-content {
    flex-grow: 1;
    max-width: 42rem;
    /* max-w-2xl */
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Back Link */
.back-link-container {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #16a34a;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: #15803d;
}

/* Calculator Card */
.calculator-card {
    background-color: #ffffff;
    border-radius: 1rem;
    /* rounded-2xl */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    /* shadow-sm */
    border: 1px solid #f3f4f6;
    /* border-gray-100 */
    padding: 1.5rem;
}

/* Responsive Grid & Utilities */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #374151;
    /* text-gray-700 */
    margin-bottom: 0.5rem;
}

.label-icon {
    color: #16a34a;
    font-size: 0.875rem;
}

/* Input Fields */
.form-control {
    width: 100%;
    background-color: #f9fafb;
    /* bg-gray-50 */
    border: 1px solid #e5e7eb;
    /* border-gray-200 */
    border-radius: 0.75rem;
    /* rounded-xl */
    padding: 0.75rem 1rem;
    color: #1f2937;
    font-size: 1.125rem;
    /* text-lg */
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: #16a34a;
    background-color: #ffffff;
}

.cursor-pointer {
    cursor: pointer;
}

/* Number Input Unit Wrapper */
.input-relative {
    position: relative;
}

.pr-12 {
    padding-right: 3rem;
}

.input-unit {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-weight: 500;
}

.divider {
    border: 0;
    border-top: 1px solid #f3f4f6;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Result Area */
.result-box {
    background: linear-gradient(to bottom right, #f0fdf4, #ecfdf5);
    /* from-green-50 to-emerald-50 */
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #dcfce7;
}

.result-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: #166534;
    /* text-green-800 */
    margin-bottom: 0.75rem;
}

.result-input {
    background-color: #ffffff;
    border-color: #bbf7d0;
    color: #15803d;
    font-weight: 700;
    font-size: 1.25rem;
    /* text-xl */
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    cursor: default;
}

.result-text-container {
    padding-top: 0.5rem;
    text-align: center;
}

.result-text-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.result-thai-date {
    font-size: 1.5rem;
    /* text-2xl */
    font-weight: 700;
    color: #047857;
    /* text-emerald-700 */
    margin-top: 0.25rem;
}

/* Footer Section */
.main-footer {
    background-color: #1f2937;
    color: #9ca3af;
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    border-top: 1px solid #374151;
}

/* Media Queries for Responsiveness (MD Breakpoints) */
@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        /* sm:grid-cols-2 */
    }
}

@media (min-width: 768px) {
    .header-title {
        font-size: 1.875rem;
        /* md:text-3xl */
    }

    .calculator-card {
        padding: 2rem;
        /* md:p-8 */
    }
}