/* Nepal National Library (NNL) Official Government CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    --gov-red: #DC143C;
    --gov-red-dark: #A00C2B;
    --gov-blue: #002147;
    --gov-blue-light: #0b498f;
    --gov-gold: #FFD700;
    --bg-light: #F4F6F9;
    --card-bg: #FFFFFF;
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   GOVERNMENT HEADER WITH NEPAL SKYLINE BACKGROUND
   ========================================================================== */
.top-gov-bar {
    background: linear-gradient(90deg, var(--gov-blue) 0%, #001229 100%);
    color: #ffffff;
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--gov-gold);
}

.top-gov-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.top-gov-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.top-gov-info span i {
    color: var(--gov-gold);
    margin-right: 5px;
}

/* HEADER WITH SKYLINE BACKGROUND IMAGE */
.official-header {
    background: #264F8B url('../images/header-bg.png') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    box-shadow: var(--shadow-sm);
    border-bottom: 3px solid var(--gov-red);
    position: relative;
    padding: 15px 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 2;
}

.header-branding {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-emblem {
    height: 85px;
    width: auto;
    object-fit: contain;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-text .gov-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #FFB6C1; /* Pinkish color like screenshot */
    text-transform: none  !important ;
    letter-spacing: 0.8px;
    margin: 0;
}

.header-text .ministry {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #ffffff;
    margin: 2px 0;
}

.header-text .nnl-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    text-transform: capitalize;
}

.header-text .location {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #FACC15; /* Yellow/Gold */
    font-weight: 600;
    margin: 2px 0 0 0;
}

.header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

/* NAVBAR BOOTSTRAP OVERRIDES */
.gov-nav {
    background: var(--gov-blue) !important;
}

.gov-nav .navbar-nav .nav-link {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 18px !important;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.gov-nav .navbar-nav .nav-link:hover,
.gov-nav .navbar-nav .nav-link.active {
    color: var(--gov-gold) !important;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: var(--gov-gold);
}

.admin-nav-btn {
    background: var(--gov-red);
    color: #ffffff !important;
    padding: 8px 16px !important;
    border-radius: 6px;
    margin-left: 10px;
}

.admin-nav-btn:hover {
    background: var(--gov-red-dark) !important;
}

/* ==========================================================================
   MAIN CONTENT & CONTAINER
   ========================================================================== */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 25px auto;
    padding: 0 15px;
}

.hero-banner {
    background: linear-gradient(135deg, var(--gov-blue) 0%, #003366 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 35px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 230px;
    height: 230px;
    background: url('../images/nnl-logo.png') no-repeat center center;
    background-size: contain;
    opacity: 0.12;
    pointer-events: none;
}

.hero-banner h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: #ffffff;
}

.hero-banner p {
    font-size: 1.05rem;
    max-width: 750px;
    color: #E2E8F0;
    margin-bottom: 22px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--gov-red);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--gov-red-dark);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

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

.btn-outline:hover {
    background: var(--gov-blue);
    color: #ffffff;
}

/* ==========================================================================
   CARDS & FORMS
   ========================================================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 25px;
    margin-bottom: 25px;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gov-blue);
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--gov-red);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

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

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

.form-group label .required {
    color: var(--gov-red);
}

.form-control {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #FAFAFA;
}

.form-control:focus {
    outline: none;
    border-color: var(--gov-blue);
    box-shadow: 0 0 0 3px rgba(0, 33, 71, 0.1);
    background-color: #FFFFFF;
}

.form-control.uppercase-input {
    text-transform: uppercase;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   OFFICIAL LIBRARY ENTRY CARD STYLING (EXACT 1:1 REPLICA & MOBILE SCALING)
   ========================================================================== */
.card-preview-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    overflow-x: auto;
    padding: 10px 0;
}

.nnl-official-id-card {
    width: 380px;
    height: 620px;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    border: 2px solid #D0D0D0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0 auto;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Top Header Bar */
.id-card-header {
    background-color: #DC143C; /* Official Red */
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #FFFFFF;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-bottom: 2px solid #A00C2B;
}

/* Main Card Body */
.id-card-body {
    flex: 1;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    background: #FFFFFF;
}

/* Watermark Background Logo */
.id-card-body::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    height: 380px;
    background: url('../images/nnl-logo.png') no-repeat center center;
    background-size: contain;
    opacity: 0.75;
    filter: brightness(1.05) contrast(1.45);
    pointer-events: none;
    z-index: 1;
}

.nnl-official-id-card {
    background: #FFFFFF;
}

.id-card-body {
    flex: 1;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    background: #FFFFFF;
}

.id-card-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Photo Box */
.id-photo-wrapper {
    width: 135px;
    height: 165px;
    border: 3px solid #DC143C;
    border-radius: 14px;
    overflow: hidden;
    background: #EFEFEF;
    margin-top: 5px;
    margin-bottom: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.id-photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Name */
.id-student-name {
    color: #DC143C; /* Red */
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 4px;
}

/* ID Code */
.id-student-code {
    color: #002147; /* Blue */
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    font-style: italic;
    text-align: center;
    margin-bottom: 8px;
}

/* QR Container */
.id-qr-wrapper {
    width: 140px;
    height: 140px;
    padding: 6px;
    background: #FFFFFF;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border: 1px solid #E0E0E0;
}

.id-qr-wrapper canvas,
.id-qr-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* Disclaimer text */
.id-disclaimer {
    color: #DC143C;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

/* Bottom Blue Banner */
.id-card-footer {
    background-color: #002147; /* Blue */
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #FFFFFF;
}

.id-footer-emblem {
    height: 55px;
    width: auto;
    object-fit: contain;
}

.id-footer-text {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.35;
}

.id-footer-text .gov-title { font-weight: 600; }
.id-footer-text .ministry-title { font-weight: 600; }
.id-footer-text .nnl-title { font-weight: 800; font-size: 0.95rem; }
.id-footer-text .address-title { font-weight: 500; }
.id-footer-text .phone-title { font-weight: 600; }

/* ==========================================================================
   STATUS BADGES & TABLES
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF9C3; color: #854D0E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #E0F2FE; color: #075985; }
.badge-secondary { background: #E2E8F0; color: #475569; }

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9rem;
}

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

.table th {
    background-color: #F8FAFC;
    color: var(--gov-blue);
    font-weight: 700;
}

.table tbody tr:hover {
    background-color: #F1F5F9;
}

/* FOOTER */
.official-footer {
    background: var(--gov-blue);
    color: #FFFFFF;
    margin-top: auto;
    border-top: 4px solid var(--gov-red);
    padding: 35px 0 20px 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
}

.footer-col h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--gov-gold);
    font-size: 1.1rem;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
}

.footer-col p, .footer-col li {
    font-size: 0.88rem;
    color: #CBD5E1;
    margin-bottom: 8px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li a {
    color: #CBD5E1;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-col ul li a:hover {
    color: var(--gov-gold);
}

.footer-bottom {
    max-width: 1200px;
    margin: 25px auto 0 auto;
    padding: 18px 15px 0 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 0.85rem;
    color: #94A3B8;
}

/* MOBILE MEDIA QUERY RESPONSIVENESS */
@media (max-width: 768px) {
    .header-text h2 { font-size: 1.15rem; }
    .header-text h3 { font-size: 0.8rem; }
    .hero-banner { padding: 25px 20px; }
    .hero-banner h1 { font-size: 1.5rem; }
    .hero-banner p { font-size: 0.95rem; }
    .official-header { background-size: cover; }
    .nnl-official-id-card { transform: scale(0.92); transform-origin: top center; margin-bottom: -40px; }
}

/* PRINT MEDIA OVERRIDES */
@media print {
    body * {
        visibility: hidden;
    }
    .card-preview-container,
    .card-preview-container * {
        visibility: visible;
    }
    .card-preview-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
    }
    .nnl-official-id-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        transform: none !important;
    }
    .no-print {
        display: none !important;
    }
}
