/* Import Pegasus Tokens */
@import url('../../node_modules/@mcafee/tokens-assemble-css/dist/tokens.css');
@import url('../../node_modules/@mcafee/tokens-dark-assemble-css/dist/tokens.css') screen and (prefers-color-scheme: dark);

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500&display=swap');

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Body using actual Pegasus tokens */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--BackgroundColor);
    color: #343434;
    height: 100vh; /* Exact viewport height, not min-height */
    max-height: 100vh; /* Prevent exceeding viewport height */
    overflow-x: hidden; /* Prevent horizontal scroll */
    overflow-y: hidden; /* Allow vertical scroll only if truly needed */
    display: flex;
    flex-direction: column;
}

/* Dark mode styles using actual Pegasus dark tokens */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--BackgroundColor) !important; /* Uses dark tokens: #141415 */
        color: #ffffff !important;
    }
    
    .pgs-card, .content-box {
        background: var(--SecondaryBackgroundColor) !important; /* Uses dark tokens: #222225 */
        border-color: var(--QuaternaryBackgroundColor) !important; /* Uses dark tokens: #1f1f20 */
    }
    
    .pgs-heading-h1, .title {
        color: #ffffff !important;
    }
    
    .pgs-body-text, .subtitle {
        color: #cccccc !important;
    }
    
    .pgs-divider-vertical, .separator {
        color: #666666 !important;
    }
    
    .pgs-link {
        color: #6285f9 !important;
    }
    
    .pgs-link:hover {
        color: #8aa5fc !important;
    }
    
    .footer {
        background-color: transparent !important;
    }
    
    .copyright {
        color: #cccccc !important;
    }
}

/* Alternative approach using data-theme attribute */
[data-theme="dark"] {
    background-color: var(--BackgroundColor) !important; /* Uses dark tokens: #141415 */
    color: #ffffff !important;
}

[data-theme="dark"] .pgs-card {
    background: var(--SecondaryBackgroundColor) !important; /* Uses dark tokens: #222225 */
    border-color: var(--QuaternaryBackgroundColor) !important; /* Uses dark tokens: #1f1f20 */
}

[data-theme="dark"] .pgs-heading-h1 {
    color: #ffffff !important;
}

[data-theme="dark"] .pgs-body-text {
    color: #cccccc !important;
}

[data-theme="dark"] .pgs-divider-vertical {
    color: #666666 !important;
}

[data-theme="dark"] .pgs-link {
    color: #6285f9 !important;
}

[data-theme="dark"] .pgs-link:hover {
    color: #8aa5fc !important;
}

[data-theme="dark"] .copyright {
    color: #cccccc !important;
}

/* Legacy dark mode compatibility */
[data-theme="dark"] .content-box {
    background: var(--SecondaryBackgroundColor) !important; /* Uses dark tokens: #222225 */
    border-color: var(--QuaternaryBackgroundColor) !important; /* Uses dark tokens: #1f1f20 */
}

[data-theme="dark"] .title {
    color: #ffffff !important;
}

[data-theme="dark"] .subtitle {
    color: #cccccc !important;
}

[data-theme="dark"] .separator {
    color: #666666 !important;
}

[data-theme="dark"] .footer {
    background-color: transparent !important;
    border-top-color: var(--QuaternaryBackgroundColor) !important;
}

/* Logo section - Always 24px from viewport top */
.top-logo {
    text-align: center;
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.mcafee-logo {
    width: 120px;
    height: auto;
    max-width: 100%;
}

/* Auth frame - 448px width, 773px height, 24px from top, centered */
.main-content {
    width: 448px;
    height: 773px;
    margin: 24px auto 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Pegasus Card Component */
.pgs-card {
    background: var(--SecondaryBackgroundColor);
    border-radius: 4px;
    border: 1px solid var(--SecondaryBackgroundColor);
    box-shadow: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.pgs-card-content {
    padding: 24px; /* 24px padding inside content box */
}

/* Content box using Pegasus card - Default for >1366px */
.content-box {
    text-align: center;
    width: 400px;
    height: 184px;
    margin-top: 216px; /* 216px from top of frame */
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box; /* Ensure borders are included in dimensions */
    min-width: 400px; /* Ensure minimum width */
    min-height: 184px; /* Ensure minimum height */
}

/* Pegasus Typography Components - Default with line break constraints */
.pgs-heading-h1 {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 24px;
    line-height: 1.4;
    letter-spacing: 0%;
    color: rgba(52, 52, 52, 1);
    transition: color 0.3s ease;
    /* Title box: 352x64 with 22px padding left/right inside */
    width: 352px;
    height: 64px;
    padding: 0 22px; /* 22px padding left and right inside title box */
    margin: 0 auto 24px auto; /* 24px gap below title */
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pgs-body-text {
    font-size: 16px;
    color: rgba(52, 52, 52, 1);
    font-weight: 400;
    line-height: 1.4;
    width: 352px;
    height: 48px;
    transition: color 0.3s ease;
    /* Subtitle: just text, center-aligned */
    text-align: center;
    margin: 0;
    padding: 0 8px;
}

/* Legacy classes for compatibility */
.title {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Footer using Pegasus tokens */
.footer {
    background-color: transparent;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 32px 4px 32px; /* 4px from bottom, 32px left/right */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

/* Pegasus Link Components */
.pgs-link {
    color: var(--LinkColor, #4258ff);
    text-decoration: none;
    transition: color 0.3s ease;
}

.pgs-link:hover {
    color: var(--LinkHoverColor, #6285f9);
    text-decoration: underline;
}

.pgs-link-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pgs-divider-vertical {
    color: #cccccc;
    font-weight: normal;
}

.copyright {
    font-size: 12px;
    color: var(--TextSecondary, #6e6e6e);
}

/* Responsive breakpoints */
/* 1024-1365px - Standard Desktop (current default layout) */

/* >1366px - Large Desktop with proportional scaling */
@media (min-width: 1366px) {
    .main-content {
        width: calc(448px * (100vw / 1366px));
        min-width: 448px;
        max-width: calc(448px * 1.5);
        height: calc(773px * (100vw / 1366px));
        min-height: 773px;
        max-height: calc(773px * 1.5);
    }
    
    .mcafee-logo {
        width: calc(140px * (100vw / 1366px));
        min-width: 140px;
        max-width: calc(140px * 1.5);
    }
    
    .content-box {
        width: calc(400px * (100vw / 1366px));
        min-width: 400px;
        max-width: calc(400px * 1.5);
        height: calc(184px * (100vw / 1366px));
        min-height: 184px;
        max-height: calc(184px * 1.5);
        margin-top: calc(216px * (100vw / 1366px));
    }
    
    .pgs-card-content {
        padding: min(calc(24px * (100vw / 1366px)), 36px);
    }
    
    .pgs-heading-h1 {
        width: calc(352px * (100vw / 1366px));
        min-width: 352px;
        max-width: calc(352px * 1.5);
        height: calc(64px * (100vw / 1366px));
        min-height: 64px;
        max-height: calc(64px * 1.5);
        font-size: min(calc(24px * (100vw / 1366px)), 36px);
        padding: 0 min(calc(22px * (100vw / 1366px)), 33px);
        margin: 0 auto min(calc(24px * (100vw / 1366px)), 36px) auto;
    }
    
    .pgs-body-text {
        width: calc(352px * (100vw / 1366px));
        min-width: 352px;
        max-width: calc(352px * 1.5);
        height: calc(48px * (100vw / 1366px));
        min-height: 48px;
        max-height: calc(48px * 1.5);
        font-size: min(calc(16px * (100vw / 1366px)), 24px);
        padding: 0 min(calc(8px * (100vw / 1366px)), 12px);
    }
    
    .footer {
        padding: 0 min(calc(32px * (100vw / 1366px)), 48px) min(calc(4px * (100vw / 1366px)), 6px) min(calc(32px * (100vw / 1366px)), 48px);
        font-size: min(calc(12px * (100vw / 1366px)), 18px);
    }
    
    .footer-links {
        gap: min(calc(8px * (100vw / 1366px)), 12px);
        font-size: min(calc(12px * (100vw / 1366px)), 18px);
    }
    
    .copyright {
        font-size: min(calc(12px * (100vw / 1366px)), 18px);
    }
}

/* 768-1024px - Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-content {
        width: 90vw;
        max-width: 420px;
    }
    
    .content-box {
        width: 360px !important;
        height: 170px !important;
        min-width: 360px !important;
        min-height: 170px !important;
    }
    
    .pgs-heading-h1 {
        width: 310px;
        height: 56px;
        font-size: 20px;
        padding: 0 18px;
        line-height: 1.4;
    }
    
    .pgs-body-text {
        font-size: 15px;
        line-height: 1.6;
        width: 310px;
        margin: 0 auto;
        padding: 0;
    }
}

/* 480-768px - Large Mobile */
@media (min-width: 480px) and (max-width: 767px) {
    .main-content {
        width: 95vw;
        max-width: 360px;
    }
    
    .content-box {
        width: 320px !important;
        height: 170px !important;
        min-width: 320px !important;
        min-height: 170px !important;
    }
    
    .pgs-card-content {
        padding: 22px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        box-sizing: border-box;
    }
    
    .pgs-heading-h1 {
        width: 240px;
        height: auto;
        min-height: 44px;
        font-size: 16px;
        padding: 10px 14px;
        line-height: 1.25;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .pgs-body-text {
        font-size: 13px;
        line-height: 1.4;
        width: 240px;
        margin: 0 auto;
        padding: 0;
        flex-shrink: 0;
    }
    
    /* Footer: centered layout for <768px */
    .footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
        padding: 0 16px 4px 16px;
    }
    
    .footer-links {
        justify-content: center;
    }
}

/* <480px - Small Mobile */
@media (max-width: 479px) {
    .main-content {
        width: 95vw;
        max-width: 300px;
    }
    
    .content-box {
        width: 280px !important;
        height: 160px !important;
        min-width: 280px !important;
        min-height: 160px !important;
    }
    
    .pgs-card-content {
        padding: 20px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        box-sizing: border-box;
    }
    
    .pgs-heading-h1 {
        width: 200px;
        height: auto;
        min-height: 36px;
        font-size: 14px;
        padding: 8px 12px;
        line-height: 1.2;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .pgs-body-text {
        font-size: 12px;
        line-height: 1.3;
        width: 200px;
        margin: 0 auto;
        padding: 0;
        flex-shrink: 0;
    }
    
    /* Footer: centered layout with links above copyright */
    .footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
        padding: 0 12px 4px 12px;
        font-size: 11px;
    }
    
    .footer-links {
        justify-content: center;
        font-size: 11px;
        gap: 6px;
    }
    
    .copyright {
        font-size: 11px;
    }
    
    /* RTL support for mobile */
    [dir="rtl"] .pgs-heading-h1 {
        text-align: center;
    }
    
    [dir="rtl"] .pgs-body-text {
        text-align: center;
    }
}

/* Height-specific adjustments for short viewports */
@media (max-height: 800px) {
    /* Keep the box at fixed position and clip if needed */
    .main-content {
        height: 100vh; /* Use full viewport height */
        max-height: 100vh; /* Don't exceed viewport */
        overflow: hidden; /* Clip content that overflows */
    }
    
    .content-box {
        margin-top: 162px;
    }
}

/* Special case for very short viewports - move up a little */
@media (max-height: 480px) {
    .content-box {
        margin-top: 108px;
    }
}

/* RTL Language Support using Pegasus design principles */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] body {
    text-align: right;
}

[dir="rtl"] .content-box {
    text-align: center;
}

[dir="rtl"] .title {
    text-align: center;
}

[dir="rtl"] .subtitle {
    text-align: center;
}

[dir="rtl"] .pgs-heading-h1 {
    text-align: center;
}

[dir="rtl"] .pgs-body-text {
    text-align: center;
}

[dir="rtl"] .footer {
    text-align: left;
}

[dir="rtl"] .footer-links {
    justify-content: flex-end;
    direction: rtl;
}

[dir="rtl"] .footer-links a {
    margin: 0;
}

[dir="rtl"] .footer-links .separator {
    margin: 0;
}

[dir="rtl"] .copyright {
    text-align: right;
}

/* RTL Dark mode support */
[dir="rtl"][data-theme="dark"] .footer {
    text-align: right;
}

@media (prefers-color-scheme: dark) {
    [dir="rtl"] .footer {
        text-align: right;
    }
}

/* RTL Responsive support */
@media (max-width: 768px) {
    [dir="rtl"] .footer-links {
        flex-direction: row;
        gap: 8px;
        text-align: center;
        justify-content: center;
        align-items: center;
    }
    
    [dir="rtl"] .footer-links a {
        margin: 0;
    }
    
    [dir="rtl"] .footer-links .separator {
        display: inline;
    }
}

/* Accessibility features following Pegasus guidelines */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-contrast: high) {
    .content-box {
        border: 2px solid var(--BorderColor, #000000);
    }
    
    .footer-links a {
        text-decoration: underline;
    }
    
    .separator {
        font-weight: bold;
    }
}

/* Print styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .content-box {
        background: white !important;
        border: 1px solid black !important;
        box-shadow: none !important;
    }
    
    .title {
        color: black !important;
    }
    
    .subtitle {
        color: black !important;
    }
    
    .footer {
        background: white !important;
        border-top: 1px solid black;
    }
    
    .footer-links a {
        color: black !important;
        text-decoration: none !important;
    }
    
    .copyright {
        color: black !important;
    }
    
    .separator {
        color: black !important;
    }
}