/* 
   Shyam Sarathi - Modern Permission Form Styles 
   Theme: Professional, Trustworthy, Cultural (Deep Blue & Gold)
*/

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

:root {
    /* Brand Colors */
    --primary-color: #1a237e;
    /* Deep Royal Blue */
    --primary-light: #534bae;
    --primary-dark: #000051;

    --accent-color: #ffb300;
    /* Golden Amber */
    --accent-hover: #ffca28;

    /* Neutral Colors */
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-page: #f3f4f6;
    --bg-card: #ffffff;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-xl: 1.5rem;
    /* rounded-3xl approx */
    --radius-2xl: 2rem;

    /* Reference Colors */
    --red-theme: #dc2626;
    --red-light: #fef2f2;
    --red-border: #fee2e2;

    --orange-theme: #ea580c;
    --orange-light: #fff7ed;
    --orange-border: #ffedd5;

    --blue-theme: #2563eb;
    --blue-light: #eff6ff;
    --blue-border: #dbeafe;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #FFF3E0;
    background-image: url('/images/bhagwa-krishna-pattern.png') !important;
    background-repeat: repeat !important;
    background-size: 400px !important;
    background-position: top center;
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
}

/* --- Container & Layout --- */

.other-permission-container,
.vehicle-permission-container,
.bandhara-permission-container,
.medical-camp-permission-container {
    max-width: 1000px;
    margin: 48px auto;
    padding: 0 24px;
}

.other-permission-form,
.vehicle-form-card,
.bandhara-form-card,
.medical-camp-form-card {
    background: #ffffff;
    border-radius: 24px;
    /* rounded-3xl */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* shadow-xl */
    padding: 48px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* Remove old top border, use theme specific headers instead */
.other-permission-form::before,
.vehicle-form-card::before,
.bandhara-form-card::before,
.medical-camp-form-card::before {
    display: none;
}

/* --- Headers --- */

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.form-title {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.form-title-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: var(--shadow-sm);
}

.form-title-text h2 {
    font-size: 1.875rem;
    /* text-3xl */
    font-weight: 700;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.form-title-text p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
    font-weight: 400;
}

/* --- Sections --- */

.form-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Form Grid & Groups --- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 32px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

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

.form-group label {
    font-size: 0.95rem;
    font-weight: 700;
    /* font-bold */
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-group label.required::after {
    content: "*";
    color: var(--red-theme);
    font-weight: bold;
    margin-left: 2px;
}

/* --- Inputs --- */

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all var(--transition-fast);
    font-family: inherit;
    box-sizing: border-box;
    font-weight: 500;
}

/* Enforce uppercase for text inputs in permission forms */
.permission-form input[type="text"],
.permission-form textarea {
    text-transform: uppercase;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    background-color: #fff;
    border-color: #9ca3af;
}

/* Theme Focus Rings */
.bandhara-form-card input:focus,
.bandhara-form-card select:focus,
.bandhara-form-card textarea:focus {
    outline: none;
    border-color: var(--red-theme);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.medical-camp-form-card input:focus,
.medical-camp-form-card select:focus,
.medical-camp-form-card textarea:focus {
    outline: none;
    border-color: var(--orange-theme);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* --- Attachments --- */

.attachments-section {
    background: #ffffff;
    /* Clean white background */
    border-radius: var(--radius-lg);
    padding: 0;
    /* Remove padding to let title sit flush if needed, or keep it clean */
    border: none;
    /* Remove outer border */
    margin-top: 40px;
}

.attachments-header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    border-bottom: 2px solid #1a5f7a;
    /* Dark teal/blue line */
    padding-bottom: 10px;
}

.attachments-header span {
    background: #ffffff;
    padding: 0 16px;
    font-weight: 700;
    color: #065f46;
    /* Dark green text */
    font-size: 1.1rem;
    letter-spacing: normal;
    text-transform: none;
}

.attachments-header::before,
.attachments-header::after {
    display: none;
    /* Remove the side lines */
}

/* New Grid Layout for 4 items in a row */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Force 4 columns */
    gap: 20px;
}

@media (max-width: 900px) {
    .attachments-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2x2 on tablets */
    }
}

@media (max-width: 600px) {
    .attachments-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
    }
}

.attachment-card {
    background: #f8fafc;
    /* Very light gray/blue background */
    border: 1px dashed #94a3b8;
    /* Dashed gray border */
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 180px;
    position: relative;
}

.attachment-card:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.attachment-card input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.attachment-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Background Icon (Faded) */
.bg-icon {
    font-size: 4rem;
    opacity: 0.1;
    color: #334155;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Foreground Upload Icon */
.upload-icon {
    font-size: 1.5rem;
    color: #475569;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.attachment-label {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    font-size: 1rem;
}

.attachment-hint {
    font-size: 0.75rem;
    color: #94a3b8;
}

.file-name-display {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #059669;
    font-weight: 600;
    display: none;
    text-align: center;
    width: 100%;
    word-break: break-all;
}

.file-name-display.show {
    display: block;
}

.file-name-display.error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fee2e2;
}

/* Submit Button Style Override from image */
.submit-btn.primary {
    background: #ff4500;
    /* Orange-Red color */
    color: white;
    width: 100%;
    border-radius: 8px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: none;
    box-shadow: 0 4px 6px rgba(255, 69, 0, 0.2);
}

.submit-btn.primary:hover {
    background: #e03e00;
    transform: translateY(-1px);
}

/* --- Buttons --- */

.form-actions {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 20px;
}

.submit-btn {
    padding: 16px 40px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.02em;
    border: none;
}

.submit-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 6px rgba(26, 35, 126, 0.2);
}

.submit-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(26, 35, 126, 0.3);
}

.submit-btn.secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.submit-btn.secondary:hover {
    background: #f3f4f6;
    color: var(--text-main);
    border-color: #d1d5db;
}

/* --- Tabs (Vehicle Permission) --- */

.tabs {
    background: #fff;
    padding: 8px;
    border-radius: 999px;
    display: inline-flex;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.tab-btn {
    padding: 12px 24px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(26, 35, 126, 0.2);
}

.tab-btn:hover:not(.active) {
    background: #f1f5f9;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* --- Status Messages --- */

.status-message {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: none;
    font-weight: 500;
}

.status-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.status-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.status-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.status-message.info {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* --- Map Section --- */

.map-section {
    margin-top: 24px;
}

.btn-current-location {
    padding: 12px 24px;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.btn-current-location:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

#bandharaMapContainer {
    margin-top: 16px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    height: auto;
    display: none;
    border: 2px solid #2196f3;
}

#bandharaMap {
    width: 100%;
    height: 400px;
}

/* --- Responsive --- */

@media (max-width: 768px) {

    .other-permission-form,
    .vehicle-form-card,
    .bandhara-form-card,
    .medical-camp-form-card {
        padding: 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .form-title {
        flex-direction: row;
        width: 100%;
    }

    .submit-btn {
        width: 100%;
        padding: 16px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Applications Table --- */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--border-color);
}

.applications-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.applications-table th {
    background: #f8fafc;
    padding: 16px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.applications-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.95rem;
}

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

.applications-table tr:hover td {
    background-color: #f9fafb;
}

.status-pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-approved {
    background-color: #dcfce7;
    color: #166534;
}

.status-rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-pending,
.status-submitted,
.status-under_police_verification,
.status-under_nagar_palika_verification,
.status-under_eo_verification,
.status-pending_magistrate_review,
.status-under_sho_verification {
    background-color: #fef3c7;
    color: #92400e;
}

.status-draft {
    background-color: #f3f4f6;
    color: #4b5563;
}

.action-cell {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.btn-download {
    color: var(--primary-color);
    border-color: var(--blue-border);
    background: var(--blue-light);
}

.btn-download:hover {
    background: #dbeafe;
    border-color: #cae0fd;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

/* --- Success Modal Styles --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.success-modal {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.modal-overlay.show .success-modal {
    transform: scale(1);
}

/* --- Application Card Styles (New) --- */
.applications-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.application-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.application-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.app-card-id {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.app-card-body {
    padding: 20px;
    flex-grow: 1;
}

.app-row {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-row:last-child {
    margin-bottom: 0;
}

.app-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.app-value {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 500;
}

.app-card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: white;
    display: flex;
    gap: 12px;
}

.btn-card-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-view {
    background: #f3f4f6;
    color: var(--text-main);
}

.btn-view:hover {
    background: #e5e7eb;
}

.btn-download-permit {
    background: #eff6ff;
    color: var(--blue-theme);
}

.btn-download-permit:hover {
    background: #dbeafe;
}

/* --- Success Modal Styles --- */
.success-modal h3 {
    margin: 20px 0 10px;
    color: #1a237e;
    font-size: 1.5rem;
    font-weight: 700;
}

.success-modal p {
    color: #4b5563;
    margin-bottom: 24px;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

/* Checkmark Animation */
.checkmark-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}

.checkmark-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #d1fae5;
    position: absolute;
    top: 0;
    left: 0;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.checkmark-stem {
    position: absolute;
    width: 6px;
    height: 25px;
    background-color: #059669;
    top: 42px;
    left: 42px;
    transform: rotate(45deg);
    border-radius: 4px;
    opacity: 0;
    animation: fadeInCheck 0.2s 0.3s forwards;
}

.checkmark-kick {
    position: absolute;
    width: 12px;
    height: 6px;
    background-color: #059669;
    top: 55px;
    left: 28px;
    transform: rotate(45deg);
    border-radius: 4px;
    opacity: 0;
    animation: fadeInCheck 0.2s 0.3s forwards;
}

.checkmark-kick::after {
    content: '';
    position: absolute;
    top: -19px;
    left: 8px;
    width: 6px;
    height: 25px;
    background-color: #059669;
    border-radius: 4px;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInCheck {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}