/* ===== Scout Land Partner Portal - Custom Styles ===== */

/* --- CSS Variables / Design Tokens --- */
:root {
    /* Scout Land brand palette */
    --primary: #3D5C45;
    --primary-dark: #2E4534;
    --primary-light: #4E7A57;
    --accent: #7D6534;
    --accent-light: #96793F;
    --green: #3D5C45;
    --green-light: #4E7A57;
    --orange: #D4760A;
    --orange-light: #E8890F;
    --red: #C00000;
    --red-light: #D42A2A;
    --bg: #F5F3EF;
    --white: #FFFFFF;
    --gray-50: #FAF9F7;
    --gray-100: #F3F1ED;
    --gray-200: #E5E3DF;
    --gray-300: #D1CFCB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --sidebar-width: 256px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--accent); }

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-partner {
    color: var(--white);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-subtitle {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.7);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
    font-weight: 500;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.sidebar-nav .nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 4px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer-text {
    color: rgba(255,255,255,0.35);
    font-size: 11px;
    text-align: center;
    line-height: 1.4;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
}

.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-800);
    letter-spacing: -0.02em;
}

.page-body {
    padding: 24px 32px;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 20px;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-green {
    background: #ECFDF5;
    color: #065F46;
}

.badge-blue {
    background: #EFF6FF;
    color: #1E40AF;
}

.badge-orange {
    background: #FFFBEB;
    color: #92400E;
}

.badge-red {
    background: #FEF2F2;
    color: #991B1B;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-navy {
    background: #EEF5EF;
    color: var(--primary);
}

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: var(--gray-50);
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--gray-700);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

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

/* Sortable column header */
.data-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table thead th.sortable:hover {
    background: var(--gray-100);
}

/* --- KPI Cards --- */
.kpi-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: -0.02em;
}

.kpi-sub {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--green);
    color: var(--white);
}

.btn-success:hover {
    background: var(--green-light);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

/* --- Form Inputs --- */
.form-input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(61,92,69,0.15);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    cursor: pointer;
    appearance: auto;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(61,92,69,0.15);
}

/* --- Login Page --- */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    height: 60px;
    margin-bottom: 8px;
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 32px;
}

.login-form .form-group {
    margin-bottom: 18px;
    text-align: left;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    margin-top: 8px;
}

.login-btn:hover {
    background: var(--primary-light);
}

/* --- Campaign Cards --- */
.campaign-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    display: flex;
    flex-direction: column;
}

.campaign-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.campaign-card-code {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.campaign-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 6px 0 4px;
}

.campaign-card-developer {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.campaign-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.campaign-stat-label {
    font-size: 11px;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.campaign-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 2px;
}

.campaign-card-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Round Timeline Stepper --- */
.round-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 24px 0;
}

.round-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.round-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    z-index: 1;
}

.round-step-dot.completed {
    background: var(--green);
    color: var(--white);
}

.round-step-dot.active {
    background: var(--primary-light);
    color: var(--white);
    box-shadow: 0 0 0 4px rgba(61,92,69,0.25);
}

.round-step-dot.pending {
    background: var(--gray-200);
    color: var(--gray-500);
}

.round-step-label {
    margin-top: 8px;
    font-size: 11px;
    color: var(--gray-500);
    text-align: center;
    white-space: nowrap;
}

.round-step-connector {
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--gray-200);
    z-index: 0;
}

.round-step-connector.completed {
    background: var(--green);
}

.round-step:last-child .round-step-connector {
    display: none;
}

/* --- Filter Panel (Parcels page) --- */
.filter-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 800;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 280px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}

.filter-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.filter-panel-body {
    padding: 16px;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-panel.collapsed .filter-panel-body {
    display: none;
}

/* --- Map Container --- */
.map-container {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.map-container-full {
    position: absolute;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
}

/* --- Expandable Row (Callbacks) --- */
.expandable-row {
    cursor: pointer;
}

.expandable-row:hover {
    background: var(--gray-50);
}

.expanded-content {
    display: none;
    background: var(--gray-50);
}

.expanded-content.show {
    display: table-row;
}

.expanded-detail {
    padding: 16px 20px;
    border-left: 3px solid var(--primary-light);
    margin: 8px 16px;
    background: var(--white);
    border-radius: 0 6px 6px 0;
}

/* --- RVM Cards --- */
.rvm-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rvm-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #EEF5EF;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
    flex-shrink: 0;
}

.rvm-info {
    flex: 1;
}

.rvm-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.rvm-date {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* --- Utility --- */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.text-blue { color: var(--primary-light); }
.text-gray { color: var(--gray-500); }
.text-navy { color: var(--primary); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Leaflet Overrides --- */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-popup-content {
    margin: 12px 16px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}

.leaflet-popup-content strong {
    font-size: 14px;
    color: var(--gray-800);
}

.leaflet-control-layers {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
}

/* Map list view overlay */
.map-list-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    z-index: 900;
    overflow-y: auto;
    display: none;
    padding: 20px;
}

.map-list-view.show {
    display: block;
}

/* --- Search Bar --- */
.search-bar {
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 14px;
}

.search-bar input {
    padding-left: 40px;
}

/* --- Responsive (basic) --- */
@media (max-width: 1024px) {
    .page-body {
        padding: 16px 20px;
    }
}
