/* ==========================================================================
   Farm Log Notebook Stylesheet - ชัยพฤกษ์เกษตร
   ========================================================================== */

/* Global Reset & Base Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Sarabun", sans-serif;
    background-color: #f9fafb;
    color: #374151;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Utilities & Component Helpers */
.hidden {
    display: none !important;
}

.max-width-container {
    max-width: 56rem;
    /* 896px (max-w-4xl) */
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Header Brand Layout */
.app-header {
    background: linear-gradient(135deg, #16a34a, #047857);
    color: #ffffff;
    text-align: center;
    padding: 2rem 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 0.025em;
}

@media (min-width: 768px) {
    .app-header h1 {
        font-size: 1.875rem;
    }
}

.app-header p {
    color: #d1fae5;
    font-size: 0.875rem;
    font-weight: 300;
}

/* Main Content Wrapper */
.app-main {
    flex-grow: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Navigation & Storage Action Buttons Block */
.top-actions-bar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: start;
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

@media (min-width: 640px) {
    .top-actions-bar {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
}

.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 ease;
}

.back-link:hover {
    color: #15803d;
}

.action-buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    .action-buttons-group {
        width: auto;
    }
}

/* Action Control Buttons Base */
.btn-action {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    color: #ffffff;
    transition: background-color 0.2s ease;
}

.btn-excel {
    background-color: #059669;
}

.btn-excel:hover {
    background-color: #047857;
}

.btn-backup {
    background-color: #2563eb;
}

.btn-backup:hover {
    background-color: #1d4ed8;
}

.btn-import {
    background-color: #4b5563;
}

.btn-import:hover {
    background-color: #374151;
}

/* Dashboard Grid Layout split */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Card Block Design Base */
.panel-card {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    padding: 1.25rem;
}

.card-title-bar {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-title-bar span i {
    color: #16a34a;
}

.count-badge {
    background-color: #f3f4f6;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

/* Forms Structures elements */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
}

.input-control {
    width: 100%;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: #1f2937;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    font-family: inherit;
}

.input-control:focus {
    outline: none;
    border-color: #16a34a;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.05);
}

textarea.input-control {
    resize: vertical;
}

.input-control::placeholder {
    color: #9ca3af;
}

select.input-control {
    cursor: pointer;
}

/* Form Save Button */
.btn-submit-save {
    width: 100%;
    background-color: #16a34a;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
    margin-top: 0.5rem;
}

.btn-submit-save:hover {
    background-color: #15803d;
}

/* Table Management Styling */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
}

.log-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
}

.log-table th {
    background-color: #f9fafb;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.log-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    color: #4b5563;
    vertical-align: top;
}

.log-table tbody tr {
    border-bottom: 1px solid #f9fafb;
    transition: background-color 0.2s ease;
}

.log-table tbody tr:hover {
    background-color: rgba(249, 250, 251, 0.8);
}

.th-w-date {
    width: 6rem;
}

.th-w-type {
    width: 6rem;
}

.th-w-del {
    width: 3rem;
    text-align: center;
}

/* Inline Activity Type Status Badges */
.type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-default {
    background-color: #f3f4f6;
    color: #374151;
}

.badge-fertilizer {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-chemical {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-water {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-harvest {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* Detail Sub Rows Comments */
.row-main-detail {
    font-weight: 600;
    color: #1f2937;
    word-break: break-all;
}

.row-sub-note {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 0.125rem;
    word-break: break-all;
}

.row-sub-note i {
    margin-right: 0.125rem;
}

/* Action Delete Row Trigger Button */
.btn-delete-row {
    background: none;
    border: none;
    color: #f87171;
    padding: 0.25rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-delete-row:hover {
    color: #dc2626;
}

/* Empty State Notification View Box */
.empty-state-container {
    text-align: center;
    padding: 3rem 0;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-container i {
    font-size: 2.25rem;
    color: #d1d5db;
}

.empty-state-container p {
    font-size: 0.875rem;
}

/* Data Protection Notice Tip Info Box */
.security-notice-box {
    background-color: rgba(239, 246, 255, 0.6);
    border: 1px solid #dbeafe;
    border-radius: 0.75rem;
    padding: 1rem;
    font-size: 0.75rem;
    color: #475569;
    margin-top: 1rem;
}

.security-notice-box h4 {
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.security-notice-box ul {
    list-style: cubic-bezier(0.1, 0, 0, 1) inside;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding-left: 0.25rem;
    line-height: 1.6;
}

.security-notice-box ul li span.highlight-bold {
    font-weight: 600;
    color: #1e293b;
}

.security-notice-box ul li span.highlight-blue {
    font-weight: 600;
    color: #1d4ed8;
}

.security-notice-box ul li span.alert-danger {
    color: #dc2626;
    font-weight: 600;
}

/* Footer Element */
.app-footer {
    background-color: #1f2937;
    color: #9ca3af;
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    border-top: 1px solid #374151;
}

/* Responsive Grid Columns System */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .panel-form-span {
        grid-column: span 1 / span 1;
        height: fit-content;
    }

    .panel-table-span {
        grid-column: span 2 / span 2;
    }
}