/*
 * Styles for Land Record Management System
 * Curated Earth/Nature Palette with Premium Glassmorphism & Responsive Layout
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary-color: #2c5e3b;
    --primary-light: #448057;
    --primary-dark: #1b3d25;
    --accent-color: #d4af37;
    --accent-hover: #bda02b;
    --bg-color: #f6f8f5;
    --card-bg: #ffffff;
    --text-color: #2f3e35;
    --text-muted: #6b7c72;
    --border-color: #e2e8e4;
    --danger-color: #d9534f;
    --danger-hover: #c9302c;
    --success-color: #2b8a3e;
    --info-color: #228be6;
    --shadow-sm: 0 2px 4px rgba(44, 94, 59, 0.05);
    --shadow-md: 0 8px 16px rgba(44, 94, 59, 0.08);
    --shadow-lg: 0 16px 32px rgba(44, 94, 59, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image: 
        radial-gradient(at 0% 0%, rgba(44, 94, 59, 0.03) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(212, 175, 55, 0.02) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(44, 94, 59, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Header & Navigation */
header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(44, 94, 59, 0.2);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.logo-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-color);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 94, 59, 0.2);
}

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

.btn-accent:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background-color: var(--danger-hover);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Main Container */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Dashboard Banner / Stats */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(44, 94, 59, 0.2);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background-color: rgba(44, 94, 59, 0.08);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.2;
}

.stat-lbl {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Quick Action Portal Links */
.portal-card {
    background: linear-gradient(135deg, var(--primary-dark), #152d1c);
    border-radius: var(--radius-md);
    padding: 1.8rem;
    color: white;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.portal-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.portal-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.25rem;
}

.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Search and Filters */
.search-bar-container {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: all 0.25s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(44, 94, 59, 0.1);
}

/* Land Records Table */
.table-responsive {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background-color: rgba(44, 94, 59, 0.05);
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary-dark);
    padding: 1.1rem 1.25rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: middle;
}

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

tr {
    transition: background-color 0.2s ease;
}

tr:hover {
    background-color: rgba(44, 94, 59, 0.02);
}

.cell-primary {
    font-weight: 600;
    color: var(--primary-dark);
}

.cell-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-green {
    background-color: rgba(43, 138, 62, 0.1);
    color: var(--success-color);
}

.badge-gold {
    background-color: rgba(212, 175, 55, 0.1);
    color: #9a7610;
}

.badge-gray {
    background-color: rgba(107, 124, 114, 0.1);
    color: var(--text-muted);
}

.doc-link-container {
    display: flex;
    gap: 0.5rem;
}

.doc-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f1;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

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

.doc-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    color: var(--text-muted);
    background-color: #f1f3f1;
}

.action-row-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.action-row-btn:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* Mobile-Friendly Grid View (Hidden on desktop, shown on mobile) */
.mobile-cards {
    display: none;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mobile-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.mobile-card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

.mobile-card-sno {
    background-color: rgba(44, 94, 59, 0.08);
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.mobile-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    font-size: 0.85rem;
}

.mobile-card-item {
    display: flex;
    flex-direction: column;
}

.mobile-card-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-card-val {
    font-weight: 600;
    color: var(--text-color);
}

.mobile-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(21, 45, 28, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1.5rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(44, 94, 59, 0.02);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 10;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}

.modal-body {
    padding: 2rem;
}

/* Detail Display Grid inside Modal */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    background: #f8faf7;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.2rem;
    position: relative;
}

.detail-lbl {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-val-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.detail-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    color: var(--primary-color);
    background-color: rgba(44, 94, 59, 0.05);
}

.detail-item.full-width {
    grid-column: span 2;
}

.gov-action-panel {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(44, 94, 59, 0.05), rgba(212, 175, 55, 0.05));
    border: 1px solid rgba(44, 94, 59, 0.1);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
    margin-top: 1rem;
}

.gov-action-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.gov-action-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.8rem;
}

.pdf-viewer-container {
    grid-column: span 2;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: none;
}

.pdf-iframe {
    width: 100%;
    height: 450px;
    border: none;
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--primary-dark);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.toast-success {
    border-left: 4px solid var(--accent-color);
}

.toast-error {
    background-color: #8c2825;
    border-left: 4px solid var(--danger-color);
}

/* Form Styles for Admin */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-dark);
}

input, textarea, select {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: #fcfdfc;
    transition: all 0.25s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 94, 59, 0.1);
}

.file-upload-wrapper {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.file-upload-btn {
    background-color: #f0f4f1;
    color: var(--primary-color);
    border: 1px dashed var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
    transition: all 0.2s ease;
}

.file-upload-btn:hover {
    background-color: rgba(44, 94, 59, 0.05);
}

.file-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    max-width: 150px;
}

.upload-progress {
    width: 100%;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.4rem;
    display: none;
}

.upload-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.1s ease;
}

/* Modal Actions Footer */
.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background-color: rgba(44, 94, 59, 0.02);
}

/* Footer Section */
footer {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
    background-color: rgba(255, 255, 255, 0.4);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }
    
    .logo-text {
        font-size: 1.15rem;
    }
    
    main {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .portal-card {
        padding: 1.25rem;
    }
    
    .portal-actions {
        flex-direction: column;
    }
    
    .portal-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .search-bar-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-responsive {
        display: none; /* Hide HTML table on mobile */
    }
    
    .mobile-cards {
        display: grid; /* Show responsive card stack on mobile */
    }
    
    .modal-content {
        max-height: 95vh;
        border-radius: var(--radius-md);
    }
    
    .modal-body {
        padding: 1.25rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .detail-item.full-width {
        grid-column: span 1;
    }
    
    .gov-action-panel {
        grid-column: span 1;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .gov-action-links {
        flex-direction: column;
    }
    
    .gov-action-links .btn {
        width: 100%;
        justify-content: center;
    }
    
    .pdf-viewer-container {
        grid-column: span 1;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .file-upload-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}
