/* =========================================
   FARMER RECORDS MANAGEMENT SYSTEM
   PROFESSIONAL DASHBOARD CSS
========================================= */

:root {
    --green: #176744;
    --green-light: #25865b;
    --dark: #102e25;
    --ink: #19382e;
    --muted: #63786e;
    --border: #dce7df;
    --bg: #f3f7f4;
    --white: #ffffff;
    --danger: #dc2626;
    --sidebar-width: 270px;
    --radius: 12px;
}

/* GLOBAL SETTINGS */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Poppins', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

a {
    color: var(--green);
    font-weight: 500;
    text-decoration: none;
    transition: 0.25s ease;
}

a:hover {
    text-decoration: underline;
}

/* =========================================
   SIDEBAR DESIGN
========================================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg,
            #102e25 0%,
            #091f18 100%);
    color: #ffffff;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 4px 0 20px #00000010;
}

/* SIDEBAR HEADER */

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 0 15px;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: var(--green-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
}

.sidebar h2 {
    font-size: 19px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.4;
    margin: 0 0 4px;
}

.sidebar-title h2 {
    font-size: 17px;
    margin: 0;
}

.sidebar small {
    display: block;
    color: #a4bdb1;
    font-size: 11px;
    font-weight: 400;
}

/* SIDEBAR DIVIDER */

.sidebar-divider {
    width: 100%;
    height: 1px;
    flex-shrink: 0;
    background: #ffffff1c;
    margin: 16px 0;
}

/* MENU LABEL */

.sidebar .menu-label {
    color: #8eaa9c;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    margin: 8px 12px 15px;
}

/* NAVIGATION */

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 28px;
}

.sidebar nav.sidebar-nav {
    margin-top: 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c8ddd3;
    padding: 13px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
}

.sidebar a i {
    width: 22px;
    font-size: 17px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar a:hover {
    background: #ffffff12;
    color: #ffffff;
    text-decoration: none;
    transform: translateX(3px);
}

/* ACTIVE MENU */

.sidebar a.active {
    background: var(--green-light);
    color: #ffffff;
    box-shadow: 0 4px 12px #00000020;
}

.sidebar a.active i {
    color: #ffffff;
}

/* SIDEBAR BOTTOM */

.sidebar-bottom {
    margin-top: auto;
}

/* LOGOUT BUTTON */

.sidebar .logout-btn,
.sidebar a[href="logout.php"] {
    background: #ef444414;
    border: 1px solid #ef444426;
    color: #fca5a5;
    border-radius: 8px;
}

.sidebar .logout-btn:hover,
.sidebar a[href="logout.php"]:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

/* SIDEBAR FOOTER */

.sidebar-footer {
    margin-top: 20px;
    color: #819b8e;
    font-size: 10px;
    line-height: 1.8;
    text-align: center;
}

/* SIDEBAR SCROLLBAR */

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #ffffff25;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

/* =========================================
   MAIN CONTENT AREA
========================================= */

.app,
body>.wrap {
    margin-left: var(--sidebar-width);
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
    max-width: 1600px;
    min-height: 100vh;
}

.app main {
    max-width: none;
    padding: 0;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 12px;
    color: var(--ink);
}

h2 {
    font-size: 19px;
    font-weight: 600;
}

h3 {
    font-weight: 600;
}

.intro {
    margin-bottom: 24px;
}

/* =========================================
   CONTENT PANELS
========================================= */

section,
.surface,
.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin: 0 0 20px;
    box-shadow: 0 4px 16px #123e3008;
}

.muted {
    color: var(--muted);
}

.error {
    color: #a83b38;
}

/* =========================================
   FORM ELEMENTS
========================================= */

input,
textarea,
select {
    font: inherit;
    color: var(--ink);
    background: var(--white);
    border: 1px solid #c6d6cb;
    border-radius: 8px;
    padding: 11px 13px;
    max-width: 100%;
    transition: 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--green-light);
    box-shadow: 0 0 0 3px #25865b18;
}

input::placeholder,
textarea::placeholder {
    color: #92a39a;
    font-size: 13px;
}

input[type="file"] {
    padding: 14px;
    border: 2px dashed #a5c6ae;
    background: #f7faf8;
    border-radius: 10px;
}

input[type="file"]::file-selector-button {
    background: var(--green);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 9px 14px;
    margin-right: 12px;
    cursor: pointer;
    font: inherit;
}

/* =========================================
   BUTTON DESIGN
========================================= */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 11px 18px;
    background: var(--green);
    color: #ffffff;
    font: 500 13px 'Poppins', Arial, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover,
.btn:hover {
    background: #104b32;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 10px #17674420;
}

button:active,
.btn:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

button.danger,
.btn.danger,
.danger {
    background: #a83b38;
    color: #ffffff;
}

button.danger:hover,
.btn.danger:hover {
    background: #8b2525;
}

/* =========================================
   TOOLBAR
========================================= */

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin: 18px 0;
}

/* =========================================
   TABLE DESIGN
========================================= */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    background: #e7f2ea;
    color: #176744;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

td {
    font-size: 13px;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f4f9f5;
}

tbody tr:last-child td {
    border-bottom: none;
}

td form {
    display: inline-block;
    margin-left: 8px;
}

/* =========================================
   LOGIN PAGE
========================================= */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg,
            #102e25,
            #176744,
            #dceee2);
}

.login-box {
    width: min(420px, 100%);
    padding: 35px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px #123e3040;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 25px;
}

.login-box input,
.login-box button {
    width: 100%;
}

/* =========================================
   FARMER CARD PREVIEW
   ORIGINAL CARD SIZE PRESERVED
========================================= */

.card-preview {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.card {
    width: 85.6mm;
    height: 53.98mm;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #a5c6ae;
    border-radius: 3mm;
    padding: 3mm;
    overflow-wrap: anywhere;
    font: 9px/1.4 Arial, sans-serif;
    overflow: hidden;
}

.notice {
    font-weight: bold;
    color: #a00;
    font-size: 10px;
    border-bottom: 2px solid #176744;
    padding-bottom: 2mm;
}

.card h3 {
    font-size: 12px;
    margin: 2mm 0;
}

.card img {
    width: 19mm;
    height: 23mm;
    object-fit: contain;
    float: left;
    margin-right: 3mm;
}

/* =========================================
   LAND OWNERSHIP DETAILS
========================================= */

.land-record {
    padding: 16px;
    background: #f5f9f6;
    border: 1px solid #dce7df;
    border-left: 4px solid var(--green);
    border-radius: 8px;
    margin: 12px 0;
}

.land-record div {
    margin: 5px 0;
}

/* =========================================
   MOBILE RESPONSIVE DESIGN
========================================= */

@media screen and (max-width: 850px) {

    .sidebar {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        padding: 16px;
    }

    .sidebar-header {
        padding-bottom: 5px;
    }

    .sidebar nav,
    .sidebar nav.sidebar-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 10px;
    }

    .sidebar nav a {
        flex: 1 1 140px;
        justify-content: center;
        font-size: 12px;
    }

    .sidebar a:hover {
        transform: none;
    }

    .sidebar-bottom {
        margin-top: 12px;
    }

    .sidebar-footer {
        display: none;
    }

    .sidebar .logout-btn {
        justify-content: center;
    }

    .app,
    body>.wrap {
        margin: 0;
        width: 100%;
        padding: 16px;
        min-height: auto;
    }

    h1 {
        font-size: 23px;
    }

    section,
    .surface,
    .panel {
        padding: 16px;
    }

    .card-preview {
        overflow: auto;
    }

    .grid,
    .fields {
        grid-template-columns: 1fr !important;
    }

    th,
    td {
        padding: 10px 12px;
    }
}

/* =========================================
   PVC CARD PRINT SETTINGS
   85.6mm x 53.98mm
========================================= */

@page {
    size: 85.6mm 53.98mm;
    margin: 0;
}

@media print {

    html,
    body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .sidebar,
    .screen,
    .intro,
    .toolbar,
    .panel {
        display: none !important;
    }

    .app,
    body>.wrap {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
    }

    .card-preview {
        display: block;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .card {
        margin: 0;
        border-radius: 0;
        break-after: page;
        page-break-after: always;
        break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card:last-child {
        break-after: auto;
        page-break-after: auto;
    }
}