/* ================================================================
   1. GLOBAL / BASE STYLES (SHARED BY ALL DEVICES)
   ================================================================ */

/* CSS Reset & Selection Protection */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Viewport Lock - Fixed Screen (No Scrolling on Any Device) */
html,
body {
    width: 100%;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    background: #ffffff;
    color: #203a5f;
    -webkit-font-smoothing: antialiased;
}

/* Full Screen Card Wrapper */
.id-card {
    width: 100%;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    background: #ffffff;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Header Gradient Background */
.header {
    width: 100%;
    text-align: center;
    color: white;
    flex-shrink: 0;

    background: linear-gradient(
        135deg,
        #0a294d,
        #176fa8
    );
}

/* Photo Placeholder Image & Base Gradients */
.photo-placeholder {
    background: linear-gradient(
        135deg,
        #e4e9ef,
        #b9c4d0
    );
    color: #405064;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.photo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* Action Buttons Colors & Click Animation */
.call-btn {
    background: #176fa8;
}

.email-btn {
    background: #102d52;
}

.action-btn:active {
    transform: scale(0.96);
}

.call-small {
    background: #176fa8;
    color: white;
    text-decoration: none;
    border-radius: 50%;
}

.call-small:active {
    transform: scale(0.92);
}

/* Emergency Title Gradient */
.emergency-title {
    background: linear-gradient(
        135deg,
        #0a294d,
        #176fa8
    );
    color: white;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Divider Line */
.divider {
    height: 1px;
    background: #d7dee6;
    flex-shrink: 0;
}

/* Footer Bottom Indicator Line */
.home-line {
    background: #697889;
    border-radius: 20px;
}


/* ================================================================
   2. MOBILE / PHONE VIEW (DEFAULT: UP TO 599px)
   - Layout: Side-by-side (Photo & Vertical Buttons LEFT, Details RIGHT)
   - Sizing: Proportional clamp() units that scale down on small phones
   ================================================================ */

/* --- Mobile: Header --- */
.header {
    padding: clamp(3px, 0.8dvh, 8px) 12px;
}

.header h1 {
    font-size: clamp(17px, 2.9dvh, 26px);
    line-height: 1.1;
    letter-spacing: 1.5px;
}

.header p {
    margin-top: 1px;
    font-size: clamp(9px, 1.3dvh, 12px);
    letter-spacing: 1.5px;
    color: #dcecff;
}

/* --- Mobile: Content Area --- */
.content {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: clamp(6px, 1.2dvh, 12px) clamp(8px, 2.5vw, 14px) clamp(4px, 0.8dvh, 8px);

    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: clamp(8px, 1.6dvh, 15px);
    overflow: hidden;
}

/* --- Mobile: Profile Section (Side-by-Side Row) --- */
.profile-layout {
    display: grid;
    grid-template-columns: clamp(90px, 30vw, 130px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "photo details"
        "actions details";
    column-gap: 5px;
    row-gap: 3px;
    align-items: stretch;
    min-height: 0;
    min-width: 0;
    width: 100%;
    flex-shrink: 0;
}

/* --- Mobile: Photo (Top Left - Bigger Sizing) --- */
.photo-container {
    grid-area: photo;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.photo-placeholder {
    width: 100%;
    max-width: 100%;
    height: clamp(105px, 19dvh, 155px);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    border-radius: clamp(8px, 1.4dvh, 12px);
}

.person-icon {
    font-size: clamp(42px, 7dvh, 65px);
    line-height: 1;
}

.photo-text {
    margin-top: 2px;
    font-size: clamp(10px, 1.5dvh, 13px);
    font-weight: bold;
    letter-spacing: 1px;
}

/* --- Mobile: Action Buttons (Vertical Below Photo) --- */
.action-buttons {
    grid-area: actions;
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 0;
}

.action-btn {
    width: 100%;
    min-height: clamp(28px, 4.2dvh, 38px);
    padding: clamp(2px, 0.4dvh, 5px) 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: clamp(5px, 1dvh, 8px);
    color: white;
    text-decoration: none;

    font-size: clamp(10.5px, 1.6dvh, 13.5px);
    font-weight: bold;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: 0.2s;
}

/* --- Mobile: Personal Information Details (Full Width & Larger Boxes & Bigger Text) --- */
.info-grid {
    grid-area: details;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: clamp(2px, 0.4dvh, 4px);
}

.info-box {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.8vw, 9px);

    padding: clamp(3px, 0.6dvh, 6px) clamp(6px, 2vw, 10px);

    background: #f3f7fb;
    border-radius: clamp(6px, 1dvh, 8px);
    height: auto;
    min-height: clamp(28px, 4.2dvh, 38px);
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.info-icon {
    width: clamp(24px, 3.8dvh, 32px);
    height: clamp(24px, 3.8dvh, 32px);
    min-width: clamp(24px, 3.8dvh, 32px);
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #dceaf6;
    border-radius: clamp(5px, 0.9dvh, 7px);
    font-size: clamp(14px, 2.2dvh, 18px);
}

.info-text {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.label {
    display: block;
    font-size: clamp(10px, 1.45dvh, 12px);
    color: #718096;
    margin-bottom: 1px;
}

.value {
    display: block;
    font-size: clamp(12.5px, 2dvh, 15.5px);
    font-weight: bold;
    color: #203a5f;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

/* --- Mobile: Divider --- */
.divider {
    margin: 1px 0;
}

/* --- Mobile: Emergency Contacts Section --- */
.emergency-section {
    flex-shrink: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(2px, 0.35dvh, 4px);
}

.emergency-title {
    padding: clamp(3px, 0.6dvh, 6px);
    border-radius: clamp(5px, 1dvh, 8px);
    font-size: clamp(11.5px, 1.7dvh, 14.5px);
    margin-bottom: 0;
}

.emergency-contacts {
    display: flex;
    flex-direction: column;
    gap: clamp(2px, 0.35dvh, 4px);
}

.contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;

    padding: clamp(3px, 0.6dvh, 6px) clamp(8px, 2.2vw, 12px);
    background: #eef4fa;
    border-radius: clamp(6px, 1dvh, 8px);
    min-height: clamp(28px, 4dvh, 36px);
}

.contact-name {
    font-size: clamp(9.5px, 1.35dvh, 11.5px);
    color: #718096;
    margin-bottom: 1px;
}

.contact-number {
    font-size: clamp(12.5px, 1.8dvh, 15.5px);
    font-weight: bold;
    color: #203a5f;
}

.call-small {
    width: clamp(24px, 3.6dvh, 32px);
    height: clamp(24px, 3.6dvh, 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(13px, 1.8dvh, 16px);
}

/* --- Mobile: Footer --- */
.footer {
    width: 100%;
    text-align: center;
    flex-shrink: 0;
    padding: clamp(2px, 0.5dvh, 6px);
    color: #536274;
    font-size: clamp(9px, 1.3dvh, 11.5px);
    line-height: 1.2;
}

.home-line {
    width: clamp(40px, 12vw, 60px);
    height: clamp(2px, 0.4dvh, 3px);
    margin: clamp(2px, 0.4dvh, 4px) auto 0;
}


/* ================================================================
   3. TABLET VIEW (SCREENS 600px TO 1023px)
   - Layout: Centered top photo, 3-column details, horizontal buttons
   - Sizing: Tuned for iPad / Android tablet viewports
   ================================================================ */
@media (min-width: 600px) and (max-width: 1023px) {

    /* --- Tablet: Header --- */
    .header {
        padding: clamp(5px, 1.2dvh, 12px) 16px;
    }

    .header h1 {
        font-size: clamp(20px, 2.9dvh, 30px);
    }

    .header p {
        font-size: clamp(10px, 1.3dvh, 12.5px);
        margin-top: 2px;
    }

    /* --- Tablet: Content Container --- */
    .content {
        max-width: 800px;
        padding: clamp(4px, 1dvh, 10px) 16px;
    }

    /* --- Tablet: Profile Layout --- */
    .profile-layout {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: clamp(3px, 0.6dvh, 6px);
        margin-bottom: 0;
    }

    /* --- Tablet: Photo Centered on Top --- */
    .photo-container {
        order: 1;
        margin-bottom: 0;
        width: auto;
    }

    .photo-placeholder {
        width: clamp(90px, 13dvh, 120px);
        height: clamp(110px, 16dvh, 145px);
        border-radius: 10px;
    }

    .person-icon {
        font-size: clamp(40px, 6.5dvh, 58px);
    }

    .photo-text {
        font-size: 10.5px;
    }

    /* --- Tablet: Personal Info Grid (3 Columns) --- */
    .info-grid {
        order: 2;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(3px, 0.6dvh, 6px);
    }

    .info-box {
        padding: clamp(3px, 0.6dvh, 6px) 8px;
        border-radius: 7px;
        gap: 6px;
    }

    .info-icon {
        width: clamp(24px, 3.6dvh, 32px);
        height: clamp(24px, 3.6dvh, 32px);
        min-width: clamp(24px, 3.6dvh, 32px);
        font-size: clamp(13px, 1.7dvh, 16px);
    }

    .label {
        font-size: clamp(9.5px, 1.25dvh, 11px);
    }

    .value {
        font-size: clamp(12px, 1.7dvh, 14.5px);
        font-weight: bold;
    }

    /* --- Tablet: Action Buttons (Horizontal Row Below Info) --- */
    .action-buttons {
        order: 3;
        flex-direction: row;
        max-width: 420px;
        margin: 0 auto;
        gap: 8px;
        width: 100%;
    }

    .action-btn {
        flex: 1;
        min-height: clamp(30px, 3.8dvh, 36px);
        font-size: clamp(11px, 1.4dvh, 13px);
        border-radius: 7px;
    }

    /* --- Tablet: Divider --- */
    .divider {
        margin: clamp(2px, 0.5dvh, 5px) 0;
    }

    /* --- Tablet: Emergency Contacts (3 Columns) --- */
    .emergency-title {
        padding: clamp(3px, 0.6dvh, 6px);
        font-size: clamp(12px, 1.6dvh, 14.5px);
        margin-bottom: clamp(2px, 0.4dvh, 4px);
        border-radius: 7px;
    }

    .emergency-contacts {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(3px, 0.6dvh, 6px);
    }

    .contact {
        padding: clamp(3px, 0.6dvh, 6px) 8px;
        border-radius: 7px;
    }

    .contact-name {
        font-size: clamp(9.5px, 1.25dvh, 11px);
    }

    .contact-number {
        font-size: clamp(12.5px, 1.7dvh, 15px);
    }

    .call-small {
        width: clamp(24px, 3.6dvh, 32px);
        height: clamp(24px, 3.6dvh, 32px);
        font-size: clamp(12px, 1.6dvh, 15px);
    }

    /* --- Tablet: Footer --- */
    .footer {
        padding: clamp(3px, 0.6dvh, 6px);
        font-size: clamp(9.5px, 1.3dvh, 12px);
    }

    .home-line {
        width: 55px;
        height: 3px;
        margin: 3px auto 0;
    }
}


/* ================================================================
   4. DESKTOP / LARGE SCREEN VIEW (SCREENS 1024px AND ABOVE)
   - Layout: Centered top photo, 3-column details, horizontal buttons
   - Sizing: Spacious desktop scales, fits viewport height with no scroll
   ================================================================ */
@media (min-width: 1024px) {

    /* --- Desktop: Header --- */
    .header {
        padding: clamp(6px, 1.4dvh, 12px) 20px;
    }

    .header h1 {
        font-size: clamp(22px, 3.2dvh, 34px);
    }

    .header p {
        font-size: clamp(10.5px, 1.5dvh, 13px);
        margin-top: 2px;
    }

    /* --- Desktop: Content Container --- */
    .content {
        max-width: 1050px;
        padding: clamp(4px, 1.2dvh, 12px) 20px;
    }

    /* --- Desktop: Profile Layout --- */
    .profile-layout {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: clamp(3px, 0.6dvh, 6px);
        margin-bottom: 0;
    }

    /* --- Desktop: Photo Centered on Top --- */
    .photo-container {
        order: 1;
        margin-bottom: 0;
        width: auto;
    }

    .photo-placeholder {
        width: clamp(90px, 13dvh, 130px);
        height: clamp(110px, 16dvh, 155px);
        border-radius: 12px;
    }

    .person-icon {
        font-size: clamp(42px, 6.8dvh, 64px);
    }

    .photo-text {
        font-size: 11px;
        margin-top: 2px;
    }

    /* --- Desktop: Personal Info Grid (3 Columns) --- */
    .info-grid {
        order: 2;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(4px, 0.7dvh, 8px);
    }

    .info-box {
        padding: clamp(4px, 0.7dvh, 8px) 10px;
        border-radius: 8px;
        gap: 6px;
    }

    .info-icon {
        width: clamp(28px, 4dvh, 36px);
        height: clamp(28px, 4dvh, 36px);
        min-width: clamp(28px, 4dvh, 36px);
        font-size: clamp(14px, 1.9dvh, 17px);
        border-radius: 7px;
    }

    .label {
        font-size: clamp(10.5px, 1.35dvh, 12px);
        margin-bottom: 1px;
    }

    .value {
        font-size: clamp(13.5px, 1.85dvh, 16.5px);
        font-weight: bold;
    }

    /* --- Desktop: Action Buttons (Horizontal Row Below Info) --- */
    .action-buttons {
        order: 3;
        flex-direction: row;
        max-width: 440px;
        margin: 0 auto;
        gap: 10px;
        width: 100%;
    }

    .action-btn {
        flex: 1;
        min-height: clamp(32px, 4dvh, 38px);
        font-size: clamp(12px, 1.5dvh, 14px);
        border-radius: 8px;
    }

    /* --- Desktop: Divider --- */
    .divider {
        margin: clamp(3px, 0.6dvh, 6px) 0;
    }

    /* --- Desktop: Emergency Contacts (3 Columns) --- */
    .emergency-title {
        padding: clamp(4px, 0.7dvh, 8px);
        font-size: clamp(13px, 1.7dvh, 16px);
        border-radius: 8px;
        margin-bottom: clamp(3px, 0.5dvh, 5px);
    }

    .emergency-contacts {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(4px, 0.7dvh, 8px);
    }

    .contact {
        padding: clamp(4px, 0.7dvh, 8px) 10px;
        border-radius: 8px;
    }

    .contact-name {
        font-size: clamp(10.5px, 1.35dvh, 12px);
        margin-bottom: 1px;
    }

    .contact-number {
        font-size: clamp(13.5px, 1.85dvh, 16.5px);
    }

    .call-small {
        width: clamp(28px, 4dvh, 36px);
        height: clamp(28px, 4dvh, 36px);
        font-size: clamp(14px, 1.9dvh, 17px);
    }

    /* --- Desktop: Footer --- */
    .footer {
        padding: clamp(3px, 0.8dvh, 8px);
        font-size: clamp(10.5px, 1.4dvh, 13px);
        line-height: 1.25;
    }

    .home-line {
        width: 60px;
        height: 3px;
        margin: 4px auto 0;
    }
}


/* ================================================================
   5. ULTRA-WIDE & 4K DISPLAY VIEW (SCREENS 1400px AND ABOVE)
   - Layout: Maximum width container, larger font scales
   ================================================================ */
@media (min-width: 1400px) {

    .content {
        max-width: 1250px;
    }

    .header h1 {
        font-size: clamp(24px, 3.2dvh, 36px);
    }

    .photo-placeholder {
        width: clamp(110px, 14dvh, 145px);
        height: clamp(130px, 17dvh, 170px);
    }

    .person-icon {
        font-size: clamp(55px, 7.5dvh, 75px);
    }

    .value {
        font-size: clamp(14px, 2dvh, 18px);
    }
}
