/**
 * Taranagar Documents Manager - Frontend Stylesheet
 * Unique prefix: tdm-
 */

/* Container & Typography */
.tdm-container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 16px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Devanagari", sans-serif;
    color: #1e293b;
    line-height: 1.5;
}

.tdm-container * {
    box-sizing: border-box;
}

/* Controls Wrapper (Search & Category Filter) */
.tdm-controls-wrapper {
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

/* Search Bar */
.tdm-search-box-wrap {
    width: 100%;
    max-width: 540px;
}

.tdm-search-input-inner {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.tdm-search-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    pointer-events: none;
    user-select: none;
    opacity: 0.7;
}

.tdm-search-input {
    width: 100% !important;
    padding: 12px 38px 12px 42px !important;
    font-size: 15px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 30px !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    outline: none !important;
    transition: all 0.25s ease !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

.tdm-search-input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

.tdm-search-clear {
    position: absolute;
    right: 12px;
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.tdm-search-clear:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* Category Filter Tabs */
.tdm-filter-bar-wrap {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.tdm-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.tdm-filter-btn {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.tdm-filter-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

.tdm-filter-btn.tdm-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

/* 6-Card Responsive Grid */
.tdm-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

/* Fallback / Variations */
.tdm-grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tdm-grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tdm-grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Card Styling */
.tdm-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 12px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

.tdm-card:hover,
.tdm-card:focus-visible {
    transform: translateY(-4px);
    border-color: #3b82f6;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.12), 0 4px 8px rgba(0, 0, 0, 0.04);
}

.tdm-card:active {
    transform: translateY(-1px);
}

.tdm-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.tdm-card-badge-wrap {
    margin-bottom: 8px;
}

.tdm-card-badge {
    display: inline-block;
    background: #eef2ff;
    color: #4338ca;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.tdm-card-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    word-break: break-word;
}

.tdm-card-cat-tag {
    display: none; /* Can be enabled if needed */
}

/* Empty States */
.tdm-empty-search,
.tdm-empty-state {
    grid-column: 1 / -1;
    width: 100%;
    padding: 40px 20px;
    text-align: center;
}

.tdm-empty-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 32px 48px;
}

.tdm-empty-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.tdm-empty-text {
    color: #64748b;
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

/* Modal Popup & Overlay */
body.tdm-modal-open {
    overflow: hidden !important;
}

.tdm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tdm-modal-backdrop.tdm-visible {
    opacity: 1;
}

.tdm-modal-dialog {
    background: #ffffff;
    width: 100%;
    max-width: 650px;
    max-height: 88vh;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22), 0 8px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.94);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.tdm-modal-backdrop.tdm-visible .tdm-modal-dialog {
    transform: scale(1);
}

.tdm-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.tdm-modal-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.tdm-modal-content-area {
    padding: 24px 28px;
    overflow-y: auto;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
}

/* Print Watermark Header & Footer (Hidden on screen) */
.tdm-print-watermark-header,
.tdm-print-watermark-footer {
    display: none;
}

/* Modal Header */
.tdm-modal-header {
    text-align: center;
    border-bottom: 1.5px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.tdm-modal-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.tdm-modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

/* Modal Body */
.tdm-section-heading-wrap {
    margin-bottom: 14px;
}

.tdm-section-heading {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

/* Required Documents Numbered List */
.tdm-req-docs-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tdm-req-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background 0.15s ease;
}

.tdm-req-item:hover {
    background: #f1f5f9;
}

.tdm-item-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tdm-item-num {
    background: #2563eb;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tdm-item-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

/* Individual Note (Red themed) */
.tdm-individual-note {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    border-radius: 4px;
    padding: 6px 10px;
    margin-top: 4px;
    margin-left: 28px;
    font-size: 13px;
    color: #991b1b;
    line-height: 1.45;
}

.tdm-individual-note strong {
    color: #dc2626;
    margin-right: 4px;
}

/* General Note Box (Prominent Red theme) */
.tdm-general-note-container {
    margin-top: 20px;
}

.tdm-general-note-box {
    background: #fff1f2;
    border: 1.5px solid #fecdd3;
    border-left: 5px solid #e11d48;
    border-radius: 8px;
    padding: 14px 16px;
}

.tdm-general-note-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14.5px;
    color: #be123c;
    margin-bottom: 6px;
}

.tdm-general-note-body {
    font-size: 13.5px;
    color: #881337;
    line-height: 1.5;
    white-space: pre-line;
}

/* Modal Footer & Print Button */
.tdm-modal-footer {
    padding: 14px 28px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

.tdm-print-action-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 10px 28px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
}

.tdm-print-action-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.tdm-print-action-btn:active {
    transform: translateY(1px);
}

/* Responsive Media Queries */
@media screen and (max-width: 1200px) {
    .tdm-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media screen and (max-width: 860px) {
    .tdm-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
    .tdm-modal-dialog {
        max-height: 92vh;
    }
    .tdm-modal-content-area {
        padding: 18px 20px;
    }
}

@media screen and (max-width: 580px) {
    .tdm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .tdm-card {
        padding: 14px 10px;
        min-height: 105px;
    }
    .tdm-card-title {
        font-size: 13.5px;
    }
    .tdm-filter-bar {
        justify-content: flex-start;
    }
    .tdm-filter-btn {
        padding: 6px 12px;
        font-size: 12.5px;
    }
    .tdm-modal-title {
        font-size: 19px;
    }
    .tdm-individual-note {
        margin-left: 0;
    }
}

@media screen and (max-width: 360px) {
    .tdm-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Content Protection (Anti-Copy & Selection Prevention)
   ========================================================================== */
.tdm-copy-protected,
.tdm-copy-protected .tdm-card,
.tdm-copy-protected .tdm-modal-dialog,
.tdm-copy-protected .tdm-req-docs-list,
.tdm-copy-protected .tdm-req-item,
.tdm-copy-protected .tdm-item-title-row,
.tdm-copy-protected .tdm-individual-note,
.tdm-copy-protected .tdm-general-note-box,
.tdm-copy-protected .tdm-general-note-wrap,
.tdm-copy-protected .tdm-modal-header,
.tdm-copy-protected .tdm-modal-title {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Ensure Search Input remains fully selectable and editable */
.tdm-search-input {
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
}

/* Toast alert notification when copying or right clicking is attempted */
.tdm-security-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #f8fafc;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
    z-index: 10000000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tdm-security-toast.tdm-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

