/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft JhengHei", "微軟正黑體", Arial, sans-serif;
    background-color: #f0f0f0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

/* System Title */
.system-title {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    color: #4472c4;
    margin: 20px 0 10px 0;
    padding: 15px;
    background: linear-gradient(135deg, #4472c4 0%, #5b9bd5 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(68, 114, 196, 0.3);
    letter-spacing: 2px;
}

.system-brand {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #4472c4;
    margin-bottom: 20px;
    padding: 12px;
    background: linear-gradient(135deg, #4472c4 0%, #5b9bd5 100%);
    color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(68, 114, 196, 0.3);
    letter-spacing: 1px;
}

/* Color Legend */
.color-legend {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.color-legend strong {
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.box {
    width: 30px;
    height: 20px;
    border: 1px solid #ccc;
    display: inline-block;
}

.box.required {
    background-color: #e2efd9;
}

.box.optional {
    background-color: #fff2cc;
}

.box.readonly {
    background-color: #f2f2f2;
}

.purple-text {
    color: purple;
    font-weight: bold;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    background-color: #e0e0e0;
    border: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.tab-button:hover {
    background-color: #d0d0d0;
}

.tab-button.active {
    background-color: #4472c4;
    color: white;
}

/* Tax Panel */
.tax-panel {
    display: none;
}

.tax-panel.active {
    display: block;
}

/* Section Titles */
.section-title {
    background-color: #4472c4;
    color: white;
    padding: 10px;
    margin: 20px 0 10px 0;
    font-weight: bold;
    border-radius: 3px;
}

.section-title.main-title {
    background-color: #4472c4;
    font-size: 18px;
    text-align: center;
}

.section-title.green {
    background-color: #70ad47;
}

.section-title.orange {
    background-color: #c55a11;
}

.section-subtitle {
    background-color: #4472c4;
    color: white;
    padding: 5px 10px;
    margin-bottom: 15px;
    text-align: center;
    border-radius: 3px;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}

.form-group input[type="text"].required {
    background-color: #e2efd9;
}

.form-group input[type="text"].optional {
    background-color: #fff2cc;
}

.form-group input[type="text"].readonly {
    background-color: #f2f2f2;
}

/* Address field - full width and larger */
.form-group.address-full-width {
    width: 100%;
    grid-column: 1 / -1;
}

.form-group.address-full-width input[type="text"] {
    width: 100%;
    max-width: 100%;
    font-size: 15px;
    padding: 10px 12px;
}
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.hint {
    color: #666;
    font-size: 12px;
    font-weight: normal;
}

.note {
    color: #0066cc;
    font-size: 13px;
    margin: 10px 0;
    padding: 8px;
    background-color: #e6f2ff;
    border-left: 3px solid #0066cc;
}

/* Land Table */
.table-container {
    overflow-x: auto;
    margin: 15px 0;
}

.land-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.land-table th {
    background-color: #d9e1f2;
    padding: 10px 5px;
    text-align: center;
    font-size: 12px;
    border: 1px solid #b4b4b4;
    font-weight: bold;
}

.land-table td {
    padding: 5px;
    text-align: center;
    border: 1px solid #ddd;
}

.land-table td:first-child {
    background-color: #fafafa;
    font-weight: 500;
}

.land-table input[type="text"] {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    text-align: right;
    font-size: 13px;
}

.land-table input[type="text"].required {
    background-color: #e2efd9;
}

.land-table input[type="text"].optional {
    background-color: #fff2cc;
}

.land-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Total Row */
.total-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background-color: #fafafa;
    border: 1px solid #ddd;
    margin: 15px 0;
}

.total-row strong {
    font-size: 14px;
}

.total-row .result {
    background-color: #fff2cc;
    color: #c00000;
    font-weight: bold;
    padding: 8px 15px;
    border: 1px solid #ccc;
    min-width: 150px;
    text-align: right;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-item label {
    font-size: 13px;
    font-weight: 500;
}

.result-item .result {
    background-color: #fff2cc;
    color: #c00000;
    font-weight: bold;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-align: right;
    font-size: 14px;
}

.result-item-full {
    grid-column: 1 / -1;
    font-size: 15px;
    padding: 8px;
    background-color: #f0f0f0;
    border-left: 4px solid #4472c4;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 15px;
    background-color: #4472c4;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.calculate-btn:hover {
    background-color: #365a9e;
}

.calculate-btn:active {
    background-color: #2a4678;
}

/* Footer */
.footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

.warning {
    color: red;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
}

.footer-inputs {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-inputs label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.footer-inputs input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 150px;
}

/* Print Button */
.print-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0 auto;
    padding: 12px 24px;
    background-color: #70ad47;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.print-btn:hover {
    background-color: #5a8a39;
}

.print-btn:active {
    background-color: #466b2c;
}

/* Print Report Section */
.print-report {
    display: none;
}

.print-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4472c4;
}

.print-header h2 {
    color: #4472c4;
    font-size: 22px;
    margin-bottom: 5px;
}

.print-header h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 10px;
}

.print-header p {
    color: #666;
    font-size: 12px;
    margin: 3px 0;
}

.print-section {
    margin-bottom: 20px;
    page-break-inside: avoid;
}

.print-section h4 {
    background-color: #4472c4;
    color: white;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 3px;
    font-size: 14px;
}

.print-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.print-row.total {
    background-color: #fff2cc;
    padding: 10px;
    border: 1px solid #ddd;
    font-weight: bold;
    margin-top: 10px;
}

.print-label {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.print-value {
    color: #000;
    text-align: right;
    flex: 1;
}

.print-value.result {
    color: #c00000;
    font-weight: bold;
    font-size: 14px;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 11px;
}

.print-table th,
.print-table td {
    border: 1px solid #333;
    padding: 6px;
    text-align: center;
}

.print-table th {
    background-color: #d9e1f2;
    font-weight: bold;
}

.print-section-title {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #4472c4;
    margin: 15px 0;
    padding: 10px;
    background-color: #f0f0f0;
    border: 1px solid #4472c4;
}

.print-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 2px solid #c00000;
    text-align: center;
}

.print-footer p {
    color: #c00000;
    font-weight: bold;
    font-size: 12px;
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        padding: 10px;
        max-width: 100%;
    }

    .navbar,
    .tabs,
    .color-legend,
    .tax-panel,
    .footer,
    .calculate-btn,
    .tooltip .tooltiptext,
    .system-title {
        display: none !important;
    }

    .print-report {
        display: block !important;
    }

    .print-section {
        page-break-inside: avoid;
    }

    .print-table {
        page-break-inside: avoid;
    }

    h1 {
        display: none;
    }

    @page {
        margin: 15mm;
        size: A4 portrait;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 20px;
    }

    .tab-button {
        padding: 10px;
        font-size: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .land-table {
        font-size: 11px;
    }

    .land-table th,
    .land-table td {
        padding: 5px 2px;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error Messages */
.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 3px;
    margin: 10px 0;
    border-left: 4px solid #c62828;
}

/* Success Messages */
.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 10px;
    border-radius: 3px;
    margin: 10px 0;
    border-left: 4px solid #2e7d32;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #FFFFE0;
    color: black;
    text-align: left;
    border-radius: 3px;
    padding: 8px;
    border: 1px solid #ccc;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #FFFFE0 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Login/Register Styles */
.auth-container {
    max-width: 450px;
    margin: 50px auto;
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-container h2 {
    text-align: center;
    color: #4472c4;
    margin-bottom: 30px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus,
.auth-form input[type="text"]:focus {
    outline: none;
    border-color: #4472c4;
}

.auth-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    background-color: #4472c4;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.auth-form button[type="submit"]:hover {
    background-color: #365a9e;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #4472c4;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.navbar {
    background-color: #4472c4;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .user-info {
    color: white;
    font-size: 14px;
}

.navbar .logout-btn {
    background-color: #c55a11;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}

.navbar .logout-btn:hover {
    background-color: #a04809;
}
