/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: #222; /* Dark outside background for desktop viewing */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* Mobile-First Container */
.app-container {
    width: 100%;
    max-width: 414px; /* Standard large mobile width */
    height: 100vh;
    max-height: 896px;
    background-color: #061423; /* Deep navy blue matching your artboard */
    position: relative;
    overflow: hidden; /* Important for upcoming page transitions */
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.page {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Header Styles */
header {
    text-align: center;
    padding: 30px 20px 10px 20px;
}

header h1 {
    color: #6a994e; /* Earthy green */
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 5px;
}

header p {
    color: #ff5ef2; /* Darker green subtitle */
    font-size: 0.85rem;
}

/* Map Container */
.map-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}

.main-map {
    width: 100%;
    height: auto;
    max-height: 400px; /* Adjust to match your layout needs */
    object-fit: contain; /* Ensures the video scales nicely without clipping */
    display: block;
}
/* Bottom Buttons Layout */
/* --- UPDATED BUTTON LAYOUT --- */

/* Grid container remains the same */
/* --- FIXED BUTTON LAYOUT (EQUAL SIZES) --- */

/* 1. Force the grid tracks to be EXACTLY equal, overriding the auto-width text behavior */
.region-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* Forces identical column widths */
    gap: 8px; /* Slightly tighter gap so it comfortably fits mobile screens */
    padding: 15px 8px 30px 8px;
    background-color: #000000; /* Black bottom bar */
}

/* 2. Wrapper spans the full width of its equal grid cell */
.btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* 3. Keep label compact so they don't break onto multiple lines */
.region-label {
    color: #ffffff;
    font-size: 0.7rem; /* Sized perfectly for mobile */
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap; /* Keeps everything clean and single-line */
}

/* 4. Rigid, identical buttons using aspect-ratio */
.region-btn {
    background-color: #f8f9fa;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
    width: 100%; /* Perfectly spans its grid column */
    aspect-ratio: 1 / 1.15; /* Forces identical proportions across all 4 buttons */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px; /* Safe padding so images don't clip the borders */
}

.region-btn:active {
    transform: scale(0.95);
}

/* 5. Make sure the images scale relative to the button size, not the original file size */
.region-btn img {
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Dimmed & Selected states for transitions */
.region-btn.selected {
    background-color: #a7f3d0; 
}

.region-btn.dimmed {
    background-color: #555555; 
    opacity: 0.5;
}



/* --- STEP 2: PREMIUM STAGGERED COLUMN WIPE --- */

.transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none; /* Allows clicks to pass through when idle */
    z-index: 9999; /* Always on top of all elements */
}

/* ==========================================================================
   STAGGERED COLUMN WIPE TRANSITION
   ========================================================================== */

/* Base style for all transition columns */
.transition-col {
    flex: 1;
    height: 100%;
    transform: translateY(-100%); /* Starts completely hidden above the viewport */
    transition: transform 0.6s cubic-bezier(0.85, 0, 0.15, 1);
}

/* Individual column custom colors (Ocean Gradient) & staggered delays */
.transition-col:nth-child(1) { 
    background-color: #132a13; /* Deep kelp green */
    transition-delay: 0.0s; 
}

.transition-col:nth-child(2) { 
    background-color: #184e77; /* Deep sea blue */
    transition-delay: 0.1s; 
}

.transition-col:nth-child(3) { 
    background-color: #1e6091; /* Surf blue */
    transition-delay: 0.2s; 
}

.transition-col:nth-child(4) { 
    background-color: #52b69a; /* Turquoise */
    transition-delay: 0.3s; 
}

.transition-col:nth-child(5) { 
    background-color: #a7f3d0; /* Bright mint green */
    transition-delay: 0.4s; 
}
/* Wipe-In State (Covers screen) */
.transition-overlay.active {
    pointer-events: auto; /* Block user interaction during transition */
}
.transition-overlay.active .transition-col {
    transform: translateY(0);
}

/* Wipe-Out State (Uncovers screen by sliding columns off-screen to the bottom) */
.transition-overlay.exiting .transition-col {
    transform: translateY(100%);
}


/* Modal Overlay (Artboard 2) */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 150px); 
    background: rgba(0, 0, 0, 0.7);
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
}

.region-modal {
    background-color: #061423;
    border: 2px solid #1e6091;
    border-radius: 8px;
    padding: 15px;
    width: 85%;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

.region-modal p {
    color: #a9d6e5;
    font-size: 0.75rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

.modal-images {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.modal-images img {
    width: 30%;
    height: auto;
    border: 1px solid #1e6091;
    object-fit: cover;
}

.modal-actions {
    border-top: 1px solid #1e6091;
    padding-top: 10px;
}

.modal-actions span {
    color: #1e6091;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 10px;
}

.btn-yes, .btn-no {
    padding: 6px 25px;
    border: 2px solid #1e6091;
    background-color: #a9d6e5;
    color: #061423;
    font-weight: bold;
    cursor: pointer;
    margin: 0 10px;
    border-radius: 3px;
}

/* Button States for Artboard 2 */
.region-btn.selected {
    background-color: #a7f3d0; 
}
.region-btn.dimmed {
    background-color: #888888; 
    opacity: 0.6;
}


/* --- PAGE 2: ARTBOARD 3 STYLES --- */

/* Title overrides for Page 2 */
.needs-title {
    color: #6a994e;
    font-size: 1.3rem;
    font-weight: normal;
    text-transform: none;
    margin-bottom: 2px;
}

.region-title-display {
    color: #a7f3d0; /* Bright mint-green */
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}

.needs-subtitle {
    color: #4a6c38;
    font-size: 0.9rem;
    font-weight: bold;
}

/* Scrollable card area to keep layout clean on all screen heights */
.scrollable-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 15px 30px 15px;
    -ms-overflow-style: none;  /* IE/Edge */
    scrollbar-width: none;  /* Firefox */
}
.scrollable-content::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Rounded Cards */
.need-card {
    background-color: #1e2530; /* Dark slate matching the mockup */
    border: 1px solid #1e6091;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.card-img-placeholder {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background-color: #555555;
    border: 1px solid #1e6091;
}

.card-img-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-details h3 {
    color: #a9d6e5;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.card-details p {
    color: #e2e8f0;
    font-size: 0.7rem;
    line-height: 1.3;
    margin-bottom: 8px;
}

.card-action {
    display: flex;
    justify-content: flex-end;
}

/* Ok Button */
.btn-ok {
    background-color: #a7f3d0;
    border: 1px solid #1e6091;
    color: #061423;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-ok:active {
    transform: scale(0.9);
}



/* --- PAGE 3: ARTBOARD 4 FORM STYLES --- */

.form-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 15px;
}

.form-container {
    background-color: #1e2530; /* Dark slate blue container */
    border: 1px solid #1e6091;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Selected place display box */
.choice-box {
    border: 1px solid #1e6091;
    padding: 10px 12px;
    border-radius: 4px;
    background-color: rgba(30, 96, 145, 0.15);
}

#choice-text {
    color: #a9d6e5;
    font-size: 0.75rem;
    font-weight: bold;
    display: block;
    line-height: 1.4;
}

/* Text Input container styling */
.input-box-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-box-wrapper label {
    color: #a9d6e5;
    font-size: 0.8rem;
    font-weight: bold;
}

.name-input {
    width: 100%;
    background-color: #333f52; /* Balanced background color for readability */
    border: 1px solid #1e6091;
    color: #ffffff;
    font-size: 0.95rem;
    padding: 10px 12px;
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}

.name-input:focus {
    border-color: #a7f3d0; /* Shines mint green on focus */
}

/* Button Layout positioning to the right side */
.form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Send Button */
.btn-send {
    background-color: #a7f3d0;
    border: 1px solid #1e6091;
    color: #061423;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 6px 25px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-send:active {
    transform: scale(0.95);
}


/* --- PAGE 4: ARTBOARD 5 SUCCESS STYLES --- */

.success-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 15px;
}

.success-container {
    background-color: #1e2530; /* Matches our premium slate blue */
    border: 1px solid #1e6091;
    border-radius: 8px;
    padding: 25px 20px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    text-align: center;
}

/* Pop-in Checkmark Animation */
.success-icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: rgba(167, 243, 208, 0.15);
    border: 2px solid #a7f3d0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.success-checkmark {
    color: #a7f3d0;
    font-size: 2.2rem;
    font-weight: bold;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Clean Summary Panel */
.summary-box {
    width: 100%;
    background-color: #181d26; /* Slightly darker shade for depth */
    border: 1px solid #1e6091;
    border-radius: 6px;
    padding: 15px;
    box-sizing: border-box;
    text-align: left;
}

.summary-box h3 {
    color: #a9d6e5;
    font-size: 0.85rem;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(30, 96, 145, 0.4);
    padding-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-label {
    color: #94a3b8;
    font-weight: normal;
}

.summary-val {
    color: #ffffff;
    font-weight: bold;
    text-align: right;
    max-width: 70%;
    word-break: break-word;
}

.success-instructions {
    color: #cbd5e1;
    font-size: 0.75rem;
    line-height: 1.4;
    margin: 0;
}

/* Success Actions Layout */
.success-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.btn-download {
    background-color: #a7f3d0;
    border: 1px solid #1e6091;
    color: #061423;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.btn-download:hover {
    background-color: #86efac;
}

.btn-download:active {
    transform: scale(0.98);
}

.btn-restart {
    background-color: transparent;
    border: 1px solid #4a5568;
    color: #cbd5e1;
    font-size: 0.8rem;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-restart:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: #a9d6e5;
}

.btn-restart:active {
    transform: scale(0.98);
}

/* --- TOP NAVBAR --- */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background-color: #0c111a; /* Sleek, deep dark background */
    border-bottom: 1px solid rgba(30, 96, 145, 0.3);
    width: 100%;
    box-sizing: border-box;
    z-index: 5;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo {
    width: 20px;
    height: 20px;
    color: #2d35d5; /* Matches mint-green accent */
}

.app-brand-name {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* Status dot in navbar */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(167, 243, 208, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(167, 243, 208, 0.2);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: #a7f3d0;
    border-radius: 50%;
    box-shadow: 0 0 8px #a7f3d0;
}

.status-text {
    color: #a7f3d0;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* --- STRUCTURE ADJUSTMENTS FOR PAGE 1 --- */
#page-1 {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-1-main {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 105px; /* Ensures map content never gets cut off by the bottom dock */
}

/* --- BOTTOM APP DOCK STYLING --- */
.region-buttons.app-dock {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(12, 17, 26, 0.95); /* Glass-like dark background */
    backdrop-filter: blur(10px); /* Premium blur effect underneath dock */
    border-top: 1px solid rgba(30, 96, 145, 0.4);
    padding: 12px 15px calc(12px + env(safe-area-inset-bottom)) 15px; /* Dynamic padding for notch screens */
    margin: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* --- PAGE HEADER NAV & BACK BUTTON --- */
.header-nav {
    padding: 16px 20px 0 20px;
    display: flex;
    align-items: center;
    background-color: transparent;
}

.btn-back {
    background: none;
    border: none;
    color: #a7f3d0; /* Matches our mint-green accent color */
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    margin-left: -12px; /* Pulls it slightly left to align perfectly with content padding */
    border-radius: 8px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

/* Tappable feedback state */
.btn-back:active {
    background-color: rgba(167, 243, 208, 0.1);
    opacity: 0.85;
}

.back-icon {
    width: 18px;
    height: 18px;
}

/* --- ANIMATED TYPING STATUS BOX --- */
.typed-wrapper {
    background-color: rgba(12, 17, 26, 0.6); /* Translucent dark box */
    border: 1px solid rgba(30, 96, 145, 0.25);
    border-radius: 12px;
    padding: 14px 20px;
    margin: 15px auto;
    width: 85%;
    max-width: 480px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: 'Courier New', Courier, monospace; /* Clean terminal look */
}

.terminal-prefix {
    color: #a7f3d0; /* Mint green accent */
    font-weight: bold;
    user-select: none;
}

#typed-text {
    color: #e2e8f0; /* Soft off-white */
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 500;
}

/* Customize the blinking Typed.js cursor */
.typed-cursor {
    color: #a7f3d0;
    opacity: 1;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

/* ---//////////// OFFICIAL PDF PRINT LETTER STYLES --- */
.letter-page {
    font-family: 'Times New Roman', Times, serif; 
    color: #1a1a1a;
    padding: 10px 20px; /* Reduced to let the JS margins handle paper space safely */
    line-height: 1.5;
    font-size: 11pt;
    background-color: #ffffff;
    box-sizing: border-box;
  
}

.letter-header {
    width: 100%;
    margin-bottom: 24px;
    text-align: center;
}

.letterhead-img {
    width: 100%;
    height: auto;
    display: block;
}

.letter-date {
    text-align: right;
    margin-bottom: 25px;
    font-size: 11pt;
}

.letter-body p {
    text-indent: 30px;
    text-align: justify;
    margin-bottom: 8px; /* ✂️ Reduced from 15px to 8px to save an extra 30px-40px of space overall */
}

.letter-body p.salutation {
    text-indent: 0;
    font-weight: bold;
    margin-bottom: 25px;
}

/* Elegant info box layout for assignment metrics */
.assignment-box {
    margin: 15px 0; /* Changed from 30px to 15px to save space */
    border: 1.5px solid #2c3e50;
    border-radius: 6px;
    background-color: #fcfdfd;
    overflow: hidden;
}

.box-title {
    background-color: #2c3e50;
    color: #ffffff;
    margin: 0;
    padding: 8px 15px;
    font-size: 10pt;
    letter-spacing: 1px;
    text-align: center;
    font-family: Arial, sans-serif;
}

.assignment-table {
    width: 100%;
    border-collapse: collapse;
}

.assignment-table td {
    padding: 5px 12px;       /* ✂️ Shaved vertical padding in half (from 10px to 5px) */
    line-height: 1.3;        /* Slightly tighter text rows */
    vertical-align: middle;   /* Keeps text beautifully centered horizontally */
    font-size: 10pt;         /* Clean, readable size that saves space */
    border-bottom: 1px solid #e5e7eb;
}

.assignment-table tr:last-child td {
    border-bottom: none;
}

.assignment-table td.label {
    width: 28%;
    font-weight: bold;
    color: #34495e;
    font-family: Arial, sans-serif;
    padding: 5px 12px;       /* Match the compact padding */
}

.assignment-table td.value {
    width: 72%;
    color: #1a1a1a;
    padding: 5px 12px;       /* Match the compact padding */
}

.description-cell {
    font-style: italic;
}

.letter-footer {
    margin-top: 25px; /* Changed from 50px to 25px to pull it up */
    text-align: center;
    page-break-inside: avoid;
}

.signature-space {
    height: 40px; /* Changed from 60px to 40px — still plenty of room for an ink signature! */
}

.signature-office {
    font-weight: bold;
    margin: 0;
}

.signature-app {
    font-size: 9pt;
    color: #7f8c8d;
    margin: 0;
}