/* ============================================
   DOCUMENTS SECTION - FIXED SIZE CARDS
   ============================================ */

.documents-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 50%, #f0f4ff 100%);
    position: relative;
    overflow: hidden;
    padding: 60px 0;
}

.documents-section::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 102, 204, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

/* ============================================
   ⭐ MAIN CARD - EXACT FIXED SIZE
   ============================================ */
.portrait-doc-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    border: 1px solid #e9ecef;
    position: relative;
    
    /* ⭐ FIXED DIMENSIONS */
    width: 100%;
    height: 420px;              /* ⭐ FIXED TOTAL HEIGHT */
    display: flex;
    flex-direction: column;
    overflow: hidden;           /* ⭐ Prevent content overflow */
}

.portrait-doc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #0066cc;
}

/* Featured Ribbon */
.featured-ribbon {
    position: absolute;
    top: 15px;
    right: -30px;
    background: linear-gradient(135deg, #ffc107, #d39e00);
    color: #1a1a2e;
    padding: 4px 35px;
    font-size: 10px;
    font-weight: 700;
    transform: rotate(45deg);
    z-index: 5;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ============================================
   ⭐ IMAGE PREVIEW - EXACT FIXED SIZE (NO OVERLAP)
   ============================================ */
.portrait-doc-preview {
    display: block;
    width: 100%;
    height: 200px;              /* ⭐ FIXED HEIGHT */
    min-height: 200px;          /* ⭐ Min same */
    max-height: 200px;          /* ⭐ Max same (PREVENTS OVERFLOW) */
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;           /* ⭐ CRITICAL - prevents overflow */
    flex-shrink: 0;
    /* ⭐ REMOVED: aspect-ratio: 3/4 - यही problem create कर रहा था */
}

.portrait-doc-preview img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100%;
    min-height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover !important;         /* ⭐ CRITICAL */
    object-position: center top !important;
    transition: transform 0.5s;
    display: block;
}

.portrait-doc-card:hover .portrait-doc-preview img {
    transform: scale(1.05);
}

/* Image fallback */
.portrait-doc-preview img:not([src]),
.portrait-doc-preview img[src=""] {
    background: #f0f4ff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230066cc"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/></svg>') center/60px no-repeat;
}

/* PDF/Document Icon */
.portrait-doc-icon {
    width: 80px;
    height: 100px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    margin: auto;
}

.portrait-doc-icon::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 15px 15px 0;
    border-color: transparent rgba(255, 255, 255, 0.3) transparent transparent;
}

.pdf-corner-mark {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    z-index: 2;
}

/* Hover Overlay */
.portrait-doc-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 102, 204, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 3;
}

.portrait-doc-card:hover .portrait-doc-overlay {
    opacity: 1;
}

/* ============================================
   ⭐ CARD BODY - FIXED STRUCTURE
   ============================================ */
.portrait-doc-body {
    padding: 15px 12px;
    flex: 1;                    /* ⭐ Take remaining space */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;         /* ⭐ Body min height */
    overflow: hidden;           /* ⭐ Prevent overflow */
}

.category-badge {
    font-size: 9px;
    margin-bottom: 6px;
    padding: 3px 8px;
    align-self: flex-start;
    font-weight: 600;
    display: inline-block;
}

.doc-title {
    color: #1a1a2e;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.3;
    /* ⭐ Max 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
    max-height: 36px;
}

.doc-description {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
    /* ⭐ Max 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
    max-height: 34px;
}

.doc-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    color: #6c757d;
    font-size: 10px;
    margin: 8px 0;
}

.doc-meta small {
    display: flex;
    align-items: center;
    gap: 3px;
}

.doc-meta i {
    color: #0066cc;
    font-size: 10px;
}

.portrait-doc-body .btn {
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    padding: 5px 10px;
    transition: all 0.3s;
    margin-top: 2px;
}

.portrait-doc-body .btn:hover {
    transform: translateY(-2px);
}

.portrait-doc-body .btn i {
    font-size: 11px;
}

/* ============================================
   ⭐ GRID - 4 CARDS PER ROW
   ============================================ */

/* Extra Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .documents-section .col-xl-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

/* Desktop (992-1399px) */
@media (min-width: 992px) {
    .documents-section .col-lg-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

/* Tablet (768-991px) - 3 columns */
@media (max-width: 991px) and (min-width: 768px) {
    .portrait-doc-card {
        height: 400px;
    }
    .portrait-doc-preview {
        height: 180px;
        min-height: 180px;
        max-height: 180px;
    }
    .portrait-doc-body {
        min-height: 220px;
    }
    .documents-section .col-md-4 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
}

/* Mobile Large (576-767px) - 2 columns */
@media (max-width: 767px) and (min-width: 576px) {
    .portrait-doc-card {
        height: 380px;
    }
    .portrait-doc-preview {
        height: 170px;
        min-height: 170px;
        max-height: 170px;
    }
    .portrait-doc-body {
        min-height: 210px;
    }
    .documents-section .col-sm-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* Mobile Small (< 576px) - 1 column */
@media (max-width: 575px) {
    .portrait-doc-card {
        height: auto;
        min-height: 380px;
        max-width: 320px;
        margin: 0 auto;
    }
    .portrait-doc-preview {
        height: 180px;
        min-height: 180px;
        max-height: 180px;
    }
    .portrait-doc-body {
        min-height: 200px;
    }
    .documents-section .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}


/* 1. Aspect-ratio REMOVE करें */
.portrait-doc-preview {
    /* aspect-ratio: 3/4;  ❌ DELETE THIS */
    height: 200px;          /* ✅ Only this */
    min-height: 200px;      /* ✅ Add this */
    max-height: 200px;      /* ✅ Add this */
}

/* 2. Container check */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* 3. Row check */
.row {
    margin-left: -10px;
    margin-right: -10px;
}
.row > * {
    padding-left: 10px;
    padding-right: 10px;
}

