/**
 * Chhattisgarh Revenue Form Portal - Main Stylesheet
 */

:root {
    --primary: #1a5276;
    --primary-dark: #154360;
    --secondary: #2874a6;
    --accent: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #c0392b;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --border: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    color: var(--dark);
}

/* Header */
.portal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.emblem {
    width: 55px;
    height: 55px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary);
    border: 3px solid gold;
}

.title-section h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.title-section .subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.85;
}

.nav-menu {
    background: rgba(0,0,0,0.15);
    padding: 0 30px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.1);
    border-bottom-color: gold;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 18px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header-alt {
    background: linear-gradient(135deg, #5a6c7d 0%, #7f8c8d 100%);
}

.card-body {
    padding: 25px;
}

/* Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
}

.sidebar-card {
    position: sticky;
    top: 140px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    border-bottom: 1px solid var(--border);
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--light);
    color: var(--primary);
    padding-left: 25px;
}

.sidebar-menu .icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    border-left: 4px solid var(--primary);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--secondary); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--light);
    color: var(--primary);
}

.stat-card.success .stat-icon { color: var(--success); }
.stat-card.warning .stat-icon { color: var(--warning); }
.stat-card.danger .stat-icon { color: var(--danger); }
.stat-card.info .stat-icon { color: var(--secondary); }

.stat-details h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2px;
}

.stat-details p {
    font-size: 0.85rem;
    color: #666;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-group label .required {
    color: var(--accent);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.3s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(40, 116, 166, 0.1);
}

.form-control:disabled,
.form-control.locked {
    background: #e9ecef;
    cursor: not-allowed;
    color: #666;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Lock indicator for paid fields */
.field-locked {
    position: relative;
}

.field-locked::after {
    content: '🔒 Locked - Rs 30 to edit';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--warning);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 82, 118, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #2ecc71 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #f1c40f 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #e74c3c 100%);
    color: white;
}

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-draft { background: #fff3cd; color: #856404; }
.badge-submitted { background: #d1ecf1; color: #0c5460; }
.badge-processing { background: #d4edda; color: #155724; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-pending { background: #fff3cd; color: #856404; }

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 35px 30px;
    text-align: center;
}

.auth-header .emblem {
    width: 70px;
    height: 70px;
    font-size: 35px;
    margin: 0 auto 15px;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.auth-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.auth-body {
    padding: 30px;
}

.auth-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

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

/* OTP Input */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.otp-inputs input {
    width: 50px;
    height: 55px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius);
}

.otp-inputs input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Payment Section */
.payment-card {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
    border: 2px solid var(--warning);
}

.payment-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin: 15px 0;
}

.payment-amount span {
    font-size: 1rem;
    color: #666;
}

/* PDF Download Options */
.pdf-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.pdf-option-card {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.pdf-option-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.pdf-option-card .pdf-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.pdf-option-card h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--dark);
}

.pdf-option-card p {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 15px;
}

.pdf-option-card.featured {
    border-color: var(--primary);
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
}

/* Vanshavali Tree */
.tree-container {
    overflow-x: auto;
    padding: 20px;
}

.vanshavali-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 600px;
}

.tree-level {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 15px 0;
    position: relative;
}

.tree-node {
    background: white;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 15px 20px;
    text-align: center;
    min-width: 150px;
    position: relative;
    box-shadow: var(--shadow);
}

.tree-node .node-name {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

.tree-node .node-relation {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

.tree-connector {
    width: 2px;
    height: 20px;
    background: var(--primary);
    margin: 0 auto;
}

.tree-connector-horizontal {
    height: 2px;
    background: var(--primary);
    position: absolute;
    top: -16px;
}

/* Tree Builder Form */
.tree-builder-form {
    background: var(--light);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.member-list {
    max-height: 400px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all 0.3s;
}

.member-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-level {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.member-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.btn-edit { background: var(--light); color: var(--primary); }
.btn-edit:hover { background: var(--primary); color: white; }
.btn-delete { background: #fee; color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: white; }

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar-card {
        position: static;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .header-top {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .main-container {
        padding: 15px;
    }
    
    .pdf-options {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 15px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Print Styles */
@media print {
    .portal-header,
    .nav-menu,
    .sidebar-card,
    .btn-group {
        display: none !important;
    }
    
    .main-container {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Section Headers */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .section-number {
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* Info Box */
.info-box {
    background: #e8f4f8;
    border-left: 4px solid var(--secondary);
    padding: 15px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 20px;
}

.info-box p {
    margin: 0;
    font-size: 0.9rem;
    color: #0c5460;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover td {
    background: #f8f9ff;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}
