/* Modern Plot List Dashboard Styles */

:root {
    --primary-green: #10b981;
    --primary-green-hover: #059669;
    --secondary-blue: #3b82f6;
    --danger-red: #ef4444;
    --warning-yellow: #f59e0b;
    --success-green: #22c55e;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Dashboard Container */
.plot-list-dashboard {
    padding: clamp(20px, 4vw, 40px);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 1800px;
    margin: 32px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-header h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.02em;
}

.header-icon {
    width: 36px;
    height: 36px;
    color: var(--primary-green);
    stroke-width: 2.5;
}

/* Statistics Cards */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-normal);
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    cursor: pointer;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-filter.stat-active {
    border-width: 3px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px) scale(1.02);
}

.stat-filter.stat-active.stat-total {
    border-color: var(--primary-green);
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.stat-filter.stat-active.stat-occupied {
    border-color: var(--success-green);
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.stat-filter.stat-active.stat-vacant {
    border-color: var(--warning-yellow);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.stat-filter.stat-active.stat-na {
    border-color: var(--text-gray);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-gray);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    transition: all var(--transition-normal);
}

.stat-occupied { border-color: var(--success-green); }
.stat-occupied .stat-value { color: var(--success-green); }

.stat-vacant { border-color: var(--warning-yellow); }
.stat-vacant .stat-value { color: var(--warning-yellow); }

.stat-na { border-color: var(--text-light); }
.stat-na .stat-value { color: var(--text-gray); }

@keyframes pulse-scale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.stat-pulse {
    animation: pulse-scale 0.6s ease;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

/* Search box */
.search-box {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex: 1;
    max-width: 500px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-gray);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-input::placeholder {
    color: var(--text-gray);
}

.search-clear {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--bg-light);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-gray);
    text-decoration: none;
}

.search-clear:hover {
    background: var(--text-gray);
    color: white;
    transform: scale(1.1);
}

.search-clear svg {
    width: 12px;
    height: 12px;
}

.search-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.search-submit:hover {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-hover) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.search-submit svg {
    width: 16px;
    height: 16px;
}

.hide-na-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-dark);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
    user-select: none;
}

.hide-na-toggle:hover {
    border-color: var(--primary-green);
    background: var(--bg-white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.hide-na-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-green);
}

.hide-na-toggle span {
    cursor: pointer;
}

/* Clear All Filters Button */
.clear-all-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.clear-all-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.clear-all-btn svg {
    width: 16px;
    height: 16px;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    background: var(--bg-white);
}

.plot-list-table {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
}

.plot-list-table thead {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.plot-list-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.plot-list-table tbody tr {
    background: var(--bg-white);
    transition: all var(--transition-fast);
}

.plot-list-table tbody tr:nth-child(even) {
    background: var(--bg-light);
}

.plot-list-table tbody tr:hover {
    background: #ecfdf5;
    transform: scale(1.002);
}

.plot-list-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 0.9375rem;
}

.plot-number {
    color: var(--primary-green);
    font-weight: 700;
    font-size: 1.125rem;
}

/* Row States */
.row-updating {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes success-flash {
    0%, 100% { background-color: inherit; }
    50% { background-color: #d1fae5; }
}

.row-success {
    animation: success-flash 1.2s ease;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.row-error {
    animation: error-shake 0.6s ease;
    background-color: #fee2e2 !important;
}

/* Holder Badges */
.holder-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all var(--transition-normal);
}

.holder-occupied {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.holder-vacant {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.holder-na {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--text-gray);
    border: 1px solid var(--border-color);
}

/* Forms and Inputs */
.update-status-form,
.assign-plot-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
}

select,
.status-select,
.member-select {
    padding: 8px 32px 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

select:hover {
    border-color: var(--primary-green);
}

select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-light);
}

/* Status Select Colors */
.status-vacant {
    border-color: var(--warning-yellow);
    background-color: #fffbeb;
}

.status-occupied {
    border-color: var(--success-green);
    background-color: #f0fdf4;
}

.status-na {
    border-color: var(--text-light);
    background-color: var(--bg-light);
}

.select-error {
    border-color: var(--danger-red) !important;
    animation: error-shake 0.6s ease;
}

/* Buttons */
button,
.btn-update,
.btn-assign {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-hover) 100%);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}

button:hover:not(:disabled),
.btn-update:hover:not(:disabled),
.btn-assign:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-green-hover) 0%, #047857 100%);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

button svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

/* Unassign Button */
.btn-unassign {
    margin-top: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-sm);
}

.btn-unassign:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-unassign svg {
    width: 14px;
    height: 14px;
}

.btn-unassign.btn-loading {
    opacity: 0.7;
    cursor: wait;
}

.btn-update {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--secondary-blue) 0%, #2563eb 100%);
}

.btn-update:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loading {
    pointer-events: none;
}

.btn-loading svg,
.spinner {
    animation: spin 1s linear infinite;
}

/* Pagination */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 24px 0;
    border-top: 2px solid var(--border-color);
    margin-top: 24px;
}

.pagination-btn {
    padding: 10px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.pagination-btn:hover {
    border-color: var(--primary-green);
    background: var(--primary-green);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.pagination-info {
    padding: 10px 20px;
    font-size: 0.9375rem;
    color: var(--text-gray);
}

.pagination-info strong {
    color: var(--primary-green);
    font-weight: 700;
}

.pagination-total {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-left: 8px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    opacity: 0;
    transition: all var(--transition-normal);
    border-left: 4px solid;
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: var(--success-green);
}

.toast-error {
    border-left-color: var(--danger-red);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast-success .toast-icon {
    color: var(--success-green);
}

.toast-error .toast-icon {
    color: var(--danger-red);
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast-message {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.toast-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .plot-list-dashboard {
        padding: 24px;
    }

    .plot-list-table {
        min-width: 800px;
    }
}

@media (max-width: 768px) {
    .plot-list-dashboard {
        padding: 16px;
        margin: 16px;
        border-radius: var(--radius-md);
    }

    .dashboard-header h2 {
        font-size: 1.5rem;
    }

    .header-icon {
        width: 28px;
        height: 28px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .plot-list-table {
        min-width: 700px;
        font-size: 0.875rem;
    }

    .plot-list-table th,
    .plot-list-table td {
        padding: 12px;
    }

    .pagination-btn {
        padding: 8px 14px;
        font-size: 0.875rem;
    }

    #toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .update-status-form,
    .assign-plot-form {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    button,
    select {
        width: 100%;
    }

    .pagination-btn span {
        display: none;
    }
}

/* Print Styles */
@media print {
    .plot-list-dashboard {
        box-shadow: none;
        padding: 0;
    }

    .dashboard-stats,
    .update-status-form,
    .assign-plot-form,
    .pagination-container,
    #toast-container {
        display: none !important;
    }

    .plot-list-table {
        min-width: 100%;
    }

    .plot-list-table tbody tr:hover {
        background: inherit;
        transform: none;
    }
}

/* Notes Column */
.notes-cell {
    position: relative;
    min-width: 250px;
    max-width: 350px;
}

.plot-notes {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 60px;
    transition: all var(--transition-fast);
}

.plot-notes:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.plot-notes::placeholder {
    color: var(--text-gray);
    font-style: italic;
}

.notes-status {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: none;
    transition: all var(--transition-fast);
}

.notes-status.notes-saving {
    display: inline-block;
    background: #fffbeb;
    color: var(--warning-yellow);
    border: 1px solid var(--warning-yellow);
}

.notes-status.notes-saved {
    display: inline-block;
    background: #f0fdf4;
    color: var(--success-green);
    border: 1px solid var(--success-green);
}

.notes-status.notes-error {
    display: inline-block;
    background: #fef2f2;
    color: var(--danger-red);
    border: 1px solid var(--danger-red);
}
