/* ========================================
   COMMON STYLES - SHARED ACROSS ALL PAGES
   ======================================== */

/* General Body & Font Styles */
body {
    font-family: 'Inter', sans-serif;
    color: white;
    background: linear-gradient(135deg, #ffffff 0%, #b2cef0 30%, #0370e4 100%);
    /* Fallback color */
    /* background-image: url('../img/grad01.png'); */
    background-size: cover;
    background-position: center;
    overflow: hidden; /* Prevents scrollbars */
    margin: 0;
    padding: 0;
    /* --- Block Select, Drag Etc --- */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE10+/Edge */
    user-select: none;         /* Standard */
    -webkit-user-drag: none;   /* Prevents dragging images/links */
    -webkit-touch-callout: none; /* Disables the callout menu on long press */
    -webkit-tap-highlight-color: transparent; /* Removes tap highlight */
}
img {
  pointer-events: none;
}

body {
  touch-action: manipulation;
}

/* Animated Background */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Place it behind all other content */
}

.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: crossfade-overlap 36s infinite;
}

.bg-image:nth-child(1) { animation-delay: 0s; }
.bg-image:nth-child(2) { animation-delay: 4s; }
.bg-image:nth-child(3) { animation-delay: 8s; }
.bg-image:nth-child(4) { animation-delay: 12s; }
.bg-image:nth-child(5) { animation-delay: 16s; }
.bg-image:nth-child(6) { animation-delay: 20s; }
.bg-image:nth-child(7) { animation-delay: 24s; }
.bg-image:nth-child(8) { animation-delay: 28s; }
.bg-image:nth-child(9) { animation-delay: 32s; }

@keyframes crossfade-overlap {
    0% { opacity: 0; }
    25% { opacity: 1; }
    50% { opacity: 1; }
    75% { opacity: 0; }
    100% { opacity: 0; }
}

/* Static lines overlay */
.lines-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 40vw;
    height: 40vh;
    background-image: url('../img/lines.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: bottom left;
    z-index: 0;
    pointer-events: none;
}

/* Base class for the glassmorphism effect on buttons */
.glass-button {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.3) 0%, transparent 50%), rgba(255, 255, 255, 0.0);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2), inset 0 0 12px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
    /* Remove touch highlights */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: pointer;
}

.glass-button:hover {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.3) 0%, transparent 50%), rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: translateY(-3px);
}

/* New wrapper to center the entire UI on large screens */
.ui-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

/* Main Layout Containers - 2x2 Grid */
.full-screen-app {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 95vh;
    width: auto;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    z-index: 1;
    background-color: transparent;
    gap: 2rem;
    padding: 5.5rem 5.5rem;
    box-sizing: border-box;
}

/* Common Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    grid-row: 1;
    padding: 0;
}

.branding {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 5rem;
    width: auto;
    max-width: 400px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.section-title {
    display: flex;
    align-items: center;
}

.section-title-image {
    height: 3rem;
    width: auto;
    max-width: 200px;
}

.control-button {
    background: #ffa600;
    border-radius: 0.5rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.control-button:hover {
    transform: translateY(-1px);
}
.control-button:active { transform: translateY(0); background: rgba(245,245,245,0.95); }
.control-button[aria-pressed="true"] {
    outline: 2px solid #ffa600;
}

.control-icon {
    width: 1.5rem;
    height: 1.5rem;
    filter: brightness(0) invert(1); /* Makes the SVG white */
}

.card-section {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.3) 0%, transparent 50%), rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

/* Common Main Content Styles */
.main-content {
    grid-row: 2;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
    overflow: visible;
    height: 100%;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.main-content::-webkit-scrollbar {
    display: none; /* WebKit */
}

.main-content-scrollable {
    overflow-x: auto;
    overflow-y: hidden;
}

/* Case studies specific scrolling */
.case-studies-page .main-content {
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Project videos specific scrolling */
.project-videos-page .main-content {
    overflow-y: auto;
    overflow-x: hidden;
}

.main-content::-webkit-scrollbar {
    display: none; /* WebKit */
}

/* Right Card - Common styles for right-side cards */
.right-card {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Right Card Header - Common styles for right-side card headers */
.right-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Content Layout - Common styles for calculator pages */
.content-layout {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    height: 100%;
    align-items: stretch;
}

.portrait-only {
    display: none;
}

@media (max-width: 768px) {
    .content-layout {
        gap: 1rem;
    }
}

@media(min-width: 1080px) and (orientation: portrait) {
    .top-lines-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 40vw;
    height: 40vh;
    background-image: url('../img/lines2.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: top right;
    z-index: 0;
    pointer-events: none;
    }
}

@media (max-width: 1024px) and (orientation: portrait) {
    body {
        overflow-x: hidden;
    }

    .ui-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .full-screen-app {
        aspect-ratio: 3 / 4;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .header {
        flex-direction: row;
        gap: 1.5rem;
        text-align: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .main-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .content-layout {
        flex-direction: column;
        gap: 1.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        align-items: stretch;
    }

    /* Move right-card to top on portrait and mobile */
    .right-card {
        order: -1;
        padding: 1.5rem;
        height: fit-content;
        flex: none;
    }

    /* Hide right-card-header on portrait and mobile */
    .right-card-header {
        display: none;
    }

    .header-logo {
        max-width: 300px;
    }

    .section-title-image {
        height: 2.5rem;
    }

    .header-right {
        flex-direction: row;
        gap: 4rem;
    }

    .portrait-only {
        display: block;
    }
}

@media (max-width: 768px) {
    .full-screen-app {
        padding: 1rem;
    }

    .header-logo {
        height: 2.5rem;
    }

    .section-title-image {
        height: 2rem;
    }

    .right-card {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .right-card {
        padding: 1rem;
    }
}

/* Custom Numpad Popup */
.numpad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.numpad-overlay.show {
    display: flex;
}

.numpad-container {
    background: cornflowerblue;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    min-width: 280px;
    max-width: 90vw;
    box-sizing: border-box;
}

.numpad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.numpad-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    font-family: 'Inter', sans-serif;
}

.numpad-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.numpad-display {
    margin-bottom: 1.5rem;
}

.numpad-display input {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    font-size: 1.3rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-family: 'Inter', sans-serif;
    outline: none;
    box-sizing: border-box;
    overflow: hidden;
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.numpad-btn {
    padding: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    min-height: 45px;
}

.numpad-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    transform: translateY(-2px);
}

.numpad-btn:active {
    transform: translateY(0);
}

.numpad-clear {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
}

.numpad-backspace {
    background: linear-gradient(135deg, #ffa726, #ff9800);
}

.numpad-actions {
    display: flex;
    gap: 1rem;
}

.numpad-cancel {
    flex: 1;
    background: linear-gradient(135deg, #757575, #616161);
}

.numpad-ok {
    flex: 1;
    background: linear-gradient(135deg, #4caf50, #45a049);
}

/* Responsive Numpad */
@media (max-width: 768px) {
    .numpad-container {
        padding: 1.5rem;
        min-width: 280px;
    }

    .numpad-btn {
        padding: 0.75rem;
        font-size: 1.1rem;
        min-height: 45px;
    }

    .numpad-display input {
        font-size: 1.3rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .numpad-container {
        padding: 1rem;
        min-width: 260px;
    }

    .numpad-btn {
        padding: 0.625rem;
        font-size: 1rem;
        min-height: 40px;
    }

    .numpad-grid {
        gap: 0.5rem;
    }
}

/* Custom Calendar Popup */
.calendar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.calendar-overlay.show {
    display: flex;
}

.calendar-container {
    background: cornflowerblue;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    min-width: 320px;
    max-width: 90vw;
    box-sizing: border-box;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    font-family: 'Inter', sans-serif;
}

.calendar-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.calendar-nav-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    transform: translateY(-1px);
}

.calendar-month-year {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    font-family: 'Inter', sans-serif;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 0;
    font-family: 'Inter', sans-serif;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    min-height: 40px;
}

.calendar-day:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transform: translateY(-1px);
}

.calendar-day.selected {
    background: linear-gradient(135deg, #4caf50, #45a049);
    border-color: #4caf50;
    color: white;
}

.calendar-day.today {
    background: linear-gradient(135deg, #ffa726, #ff9800);
    border-color: #ffa726;
    color: white;
    font-weight: 600;
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.calendar-day.empty:hover {
    background: transparent;
    transform: none;
}

.calendar-actions {
    display: flex;
    gap: 0.75rem;
}

.calendar-btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.calendar-cancel {
    background: linear-gradient(135deg, #757575, #616161);
}

.calendar-today {
    background: linear-gradient(135deg, #ffa726, #ff9800);
}

.calendar-ok {
    background: linear-gradient(135deg, #4caf50, #45a049);
}

.calendar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive Calendar */
@media (max-width: 768px) {
    .calendar-container {
        padding: 1.5rem;
        min-width: 300px;
    }

    .calendar-day {
        min-height: 35px;
        font-size: 0.85rem;
    }

    .calendar-weekday {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .calendar-container {
        padding: 1rem;
        min-width: 280px;
    }

    .calendar-day {
        min-height: 30px;
        font-size: 0.8rem;
    }

    .calendar-weekday {
        font-size: 0.7rem;
    }

    .calendar-actions {
        gap: 0.5rem;
    }

    .calendar-btn {
        padding: 0.625rem;
        font-size: 0.85rem;
    }
}

/* Hide date input calendar icon */
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-outer-spin-button {
    display: none;
}

/* Remove touch highlights from all interactive elements */
button,
input,
select,
textarea,
a,
[role="button"],
[onclick],
.clickable {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
}

/* Remove focus outlines for touch devices */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: none;
    box-shadow: none;
}

/* Unified Form Label Styles */
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #3a59a9;
    margin-left: 1rem;
    margin-right: 1rem;
    font-family: 'Inter', sans-serif;
}

/* Responsive form label styles */
@media (max-width: 1024px) {
    .form-label {
        font-size: 0.85rem;
    }
}

/* Unified Form Input Styles */
.form-input {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.3) 0%, transparent 50%), rgba(255, 255, 255, 0.0);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2), inset 0 0 12px rgba(255, 255, 255, 0.3);
    color: white;
    width: 100%;
    padding: 1rem 1rem;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    cursor: pointer;
    text-align: left;
}

/* Number input specific styles */
.form-input[type="number"] {
    -moz-appearance: textfield;
    cursor: text;
}

.form-input[type="number"]::-webkit-outer-spin-button,
.form-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Text input specific styles */
.form-input[type="text"],
.form-input[type="date"] {
    cursor: text;
}

.form-input option {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
}

/* Placeholder styles */
.form-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* Hover and focus states */
.form-input:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.form-input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Readonly state */
.form-input[readonly] {
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

@media (min-width:1025px) and (orientation: portrait) {
    .full-screen-app {
        width: 100%;
        height: auto;
    }
}

/* iPad Air (10.9") - 1180x820 */
@media (min-width: 1180px) and (max-width: 1200px) and (orientation: landscape) {
    .full-screen-app {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

@media (min-width: 820px) and (max-width: 840px) and (orientation: portrait) {
    .full-screen-app {
        padding: 3.5rem 3.5rem;
    }

    .header-logo {
        height: auto;
    }
}

/* iPad Mini (8.3") - 1024x768 */
@media (min-width: 1024px) and (max-width: 1040px) and (orientation: landscape) {
    .full-screen-app {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
        padding: 2.5rem 2.5rem;
    }
}

@media (min-width: 768px) and (max-width: 780px) and (orientation: portrait) {
    .full-screen-app {
        width: 100%;
        height: auto;
        aspect-ratio: 3 / 4;
        padding: 2.5rem 2.5rem;
    }
}

/* Responsive form input styles */
@media (max-width: 1024px) {
    .form-input {
        padding: 0.625rem 0.875rem;
        min-height: 3rem;
        /* font-size: 0.85rem; */
    }
    .description-title {
        color: #3a59a9;
    }
}

@media (max-width: 768px) {
    .form-input {
        padding: 0.5rem 0.75rem;
        /* font-size: 0.8rem; */
    }

    select.form-input {
        padding: 0.5rem 0.75rem;
        /* font-size: 0.8rem; */
    }
}


