/* Font declarations */
@font-face {
    font-family: 'NotoEmoji';
    src: url('NotoEmoji.ttf') format('truetype');
    font-display: swap;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8fafc;
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Ensure main content grows to push footer down */
.container-fluid {
    flex: 1 0 auto;
}

/* Footer styles to ensure it stays at bottom */
footer {
    flex-shrink: 0;
}

/* Enter Stack Page - Full height, no outer scroll */
html.enter-stack-page,
body.enter-stack-page {
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body.enter-stack-page {
    display: flex;
    flex-direction: column;
}

body.enter-stack-page .navbar {
    flex-shrink: 0;
    position: relative;
}

body.enter-stack-page .navbar .container-fluid {
    overflow: visible;
}

body.enter-stack-page > .container-fluid {
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body.enter-stack-page > .container-fluid > .row {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    align-items: stretch;
}

body.enter-stack-page > .container-fluid > .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.enter-stack-page > .container-fluid > .row > [class*="col-"]:first-child {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
}

body.enter-stack-page .form-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    width: 100%;
    overflow: visible;
    padding: 0rem 0rem 50px 0rem;
}

body.enter-stack-page .form-container > .card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

body.enter-stack-page .form-container > .card > form {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    padding: 1.5rem;
}

body.enter-stack-page .form-container > .card > form::-webkit-scrollbar {
    width: 6px;
}

body.enter-stack-page .form-container > .card > form::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.4);
    border-radius: 3px;
}

body.enter-stack-page .form-container > .card > form:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.6);
}


/* Utility classes */
.d-none {
    display: none !important;
}

/* Form step styling */
.form-step {
    transition: opacity 0.3s ease;
    padding: 0px 0;
}

.form-step:not(.d-none) {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Override Bootstrap default colors */
:root {
    --bs-primary: #8BF8DE;
    --bs-primary-rgb: 73, 239, 205;
    --bs-primary-text-emphasis: #0D3049;
    --bs-link-color: #1F5D88;
    --bs-link-hover-color: #0D3049;
}

.btn-outline-primary {
    color: #0D3049;
    border-color: #8BF8DE;
}

.btn-outline-primary:hover {
    background-color: #8BF8DE;
    color: #0D3049;
    border-color: #0D3049;
}

.btn-outline-primary.active {
    background-color: #8BF8DE;
    color: #0D3049;
    border-color: #0D3049;
}

/* Fix for pressed state of form step buttons */
.btn-outline-primary:active,
.btn-outline-primary:focus-visible {
    background-color: #8BF8DE !important;
    color: #0D3049 !important;
    border-color: #0D3049 !important;
    box-shadow: 0 0 0 0.25rem rgba(73, 239, 205, 0.25) !important;
}

/* Brighter placeholder text */
::placeholder {
    color: #b1b1b2 !important;
    opacity: 1;
    font-weight: 300;
}

:-ms-input-placeholder {
    color: #b1b1b2 !important;
    font-weight: 300;
}

::-ms-input-placeholder {
    color: #b1b1b2 !important;
    font-weight: 300;
}

.progress-bar {
    background-color: #8BF8DE !important;
}

.form-check-input:checked {
    background-color: #8BF8DE !important;
    border-color: #0D3049 !important;
}

.form-select:focus,
.form-control:focus {
    border-color: #8BF8DE;
    box-shadow: 0 0 0 0.25rem rgba(73, 239, 205, 0.25);
}

/* Text box styling - smaller line height, higher min row heights */
.form-control {
    line-height: 1.35;
}

textarea.form-control {
    font-size: 0.875rem;
    line-height: 1.35;
    overflow: hidden;
    resize: vertical;
}

input.form-control[type="text"],
input.form-control[type="email"],
input.form-control[type="url"],
input.form-control[type="number"],
input.form-control[type="tel"] {
    font-size: 0.875rem;
    line-height: 1.35;
    min-height: 40px;
    overflow: visible;
}

.form-select {
    font-size: 0.875rem;
    line-height: 1.35;
}

.form-check-label {
    font-size: 0.875rem;
    line-height: 1.35;
}

.form-switch .form-check-label {
    font-size: 0.875rem;
    line-height: 1.35;
}

/* Frequency type controls and weekday selection buttons */
.habit-frequency-type + .form-check-label,
.habit-days-container .btn {
    font-size: 0.875rem;
}

.navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 0px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.navbar-brand {
    color: #0D3049 !important;
    font-weight: 500;
}

.card {
    margin-bottom: 1rem;
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-field-container {
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    margin-bottom: 1rem;
}

h2.card-title {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #2d3748;
}

.btn-primary {
    background-color: #8BF8DE;
    color: #0D3049;
    border-color: #49efce4e;
    border-radius: 12px;
    padding: 10px 30px;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #49efceb8;
    color: #0D3049;
}

.btn-primary:focus,
.btn-primary:active,
.btn-primary:active:focus {
    background-color: #49efcee4;
    color: #0D3049;
    box-shadow: 0 0 0 0.25rem rgba(73, 239, 205, 0.25);
}

.btn-secondary {
    background-color: #ffffff;
    color: #0D3049;
    border-color: rgba(180, 188, 202, 0.7);
    border-radius: 12px;
    padding: 10px 30px;
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: #49efce37;
    border-color: #0D3049;
    color: #0D3049;
}

.btn-secondary:focus,
.btn-secondary:active,
.btn-secondary:active:focus {
    background-color: #49efce67;
    color: #0D3049;
    box-shadow: 0 0 0 0.25rem rgba(73, 239, 205, 0.25);
}

/* Override Bootstrap button styles */
.btn-check:checked+.btn-outline-primary {
    background-color: rgba(139, 248, 223, 0.4) !important;
    border-color: #8BF8DE;
    color: #212529;
}

.btn-check+.btn-outline-primary {
    color: #0D3049;
    border-color: #8BF8DE;
}

/* Normal hover effect for other outline-primary buttons */
.btn-check+.btn-outline-primary:hover:not(.habit-days-container .btn-outline-primary) {
    background-color: rgba(73, 239, 205, 0.2);
    color: #0D3049;
    border-color: #8BF8DE;
}

/* Specific hover rules for habit day buttons */
/* Keep checked buttons styled on hover */
.habit-days-container .btn-check:checked+.btn-outline-primary:hover {
    background-color: rgba(139, 248, 223, 0.4) !important; /* Same as checked */
    border-color: #a4abb2 !important;      /* Grey border */
    color: #212529 !important;                         /* Same as checked */
}

/* Make unchecked buttons white on hover */
.habit-days-container .btn-check:not(:checked)+.btn-outline-primary:hover {
    background-color: #ffffffc0 !important;
    color: #0D3049 !important;
    border-color: #a4abb2 !important;  /* Grey border */
}

.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary.dropdown-toggle.show {
    background-color: #8BF8DE;
    color: #0D3049;
    border-color: #0D3049;
}

 /* Ensure btn-group takes full width */
 .habit-days-container .btn-group {
    display: flex; 
    width: 100%; 
    max-width: 450px; 
}

.habit-days-container .btn-group .btn {
    flex: 1 1 auto; 
    text-align: center;
    font-size: 0.875rem;
}

/* Allow day controls to wrap */
.habit-days-controls {
  flex-wrap: wrap;
}

/* Add grey border to habit days container */
.habit-days-container {
    padding: 0.75rem;
}

/* Override day button borders to be grey instead of primary color */
.habit-days-container .btn-check:not(:checked) + .btn-outline-primary {
    border-color: #a4abb2 !important;
    color: #0D3049 !important;
}

/* Keep checked day buttons with grey border */
.habit-days-container .btn-check:checked + .btn-outline-primary {
    border-color: #a4abb2 !important;
}

/* Fix border radius consistency */
.card,
.card-header,
.card-footer {
    border-radius: 16px;
}

.card-header {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.card-body {
    border-radius: 0;
}

.card-footer {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.card .card {
    border-radius: 12px;
}

.card .card .card-footer {
    border-radius: 0 0 12px 12px;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(240, 240, 240, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: #8BF8DE;
}

.display-4 {
    font-weight: 600;
    color: #0D3049;
}

.text-primary {
    color: #1F5D88 !important;
}

.bg-light {
    background-color: #f1f5f9 !important;
}

.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0;
}

.table th,
.table td {
    border: none;
    padding: 12px 15px;
    text-align: left;
    vertical-align: top;
}

.table thead th {
    background-color: #f8fafc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: #64748b;
}

.table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.package-row {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.package-row:hover {
    background-color: #e2e8f0;
}

/* Remove the arrow styling */
.package-row::after {
    content: none;
}

/* Add a subtle indicator that the row is expandable */
.package-title {
    position: relative;
}

.expand-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px 10px;
    transition: background-color 0.3s ease;
    border-radius: 4px;
}

.expand-btn:hover {
    background-color: #cbd5e1;
}

.text-center {
    text-align: center;
}

.habits-list {
    line-height: 1.5;
}

.habits-list strong {
    color: #64748b;
    display: block;
    margin-bottom: 5px;
}

.stat-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 100%;
    transition: box-shadow 0.3s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem;
}

.stat-card .icon {
    color: #B4BCCA;
    margin-bottom: 0.75rem;
}

.stat-card .card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-card .card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.stat-card .card-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0D3049;
    text-align: center;
    margin-bottom: 0.25rem;
}

.stat-card .text-muted {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
}

@media (max-width: 767px) {
    .stat-card {
        margin-bottom: 1rem;
    }
}

.welcome-text {
    font-size: 1.75rem;
    font-weight: 500;
    color: #0D3049;
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Remove tap highlight color on mobile */
* {
    -webkit-tap-highlight-color: transparent;
}

.container {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Simplified responsive card container for index.html */
body.index-page .container > .row > .col-md-11 {
    max-width: 900px;
    margin: 0 auto;
}

.row {
    margin-bottom: 1rem;
}

.row>* {
    padding-right: calc(var(--bs-gutter-x) * .375);
    padding-left: calc(var(--bs-gutter-x) * .375);
}

/* Add this new rule to increase horizontal spacing between stat cards */
.row>[class*="col-"] {
    padding-right: calc(var(--bs-gutter-x) * .75);
    padding-left: calc(var(--bs-gutter-x) * .75);
}

.package-container {
    margin-bottom: 2rem;
}

.package-row {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.package-row:hover {
    background-color: #e2e8f0;
}

.package-row::after {
    content: none;
}

.package-row[data-show-all-habits="true"]::after {
    transform: rotate(180deg);
}

@media (max-width: 1199px) {
    .col-12+.col-12 {
        margin-top: 0.5rem;
    }
}

.more-habits {
    display: block;
    color: #a0aec0;
    font-size: 14px;
    margin-top: 5px;
}

.package-row[data-show-all-habits="true"] .more-habits {
    display: none;
}

.stat-card.current-quarter {
    border: 1px solid #0D3049;
}

.current-quarter-container {
    border: 1px solid #0D3049;
    border-radius: 16px;
    background-color: #f0fff4;
}

.current-quarter-card {
    border: 1px solid #0D3049;
}

.invoice-item {
    background-color: #ffffff;
    border: 1px solid rgba(180, 188, 202, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.invoice-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: rgba(73, 239, 205, 0.5);
}

.invoice-details {
    flex: 1;
}

.invoice-link {
    display: inline-block;
    color: #0D3049;
    text-decoration: none;
    background-color: #ffffff;
    border: 1px solid rgba(180, 188, 202, 0.7);
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.invoice-link:hover {
    background-color: #8BF8DE;
    color: #0D3049;
    border-color: #0D3049;
}

/* Text colors */
.text-muted {
    color: #64748b !important;
}

/* Form navigation */
.form-navigation {
    margin-top: 2rem;
}

.nav-btn {
    transition: all 0.3s ease;
}

.nav-btn.active {
    transform: scale(1.05);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Minimalistic Progress Indicator */
.minimal-progress {
    position: relative;
    margin: 1rem 0;
}

.progress-track {
    height: 2px;
    background-color: #e9ecef;
    border-radius: 1px;
    position: relative;
    margin-bottom: 0.75rem;
    padding-left: calc((100% - 6px) / 8);
    padding-right: calc((100% - 6px) / 8);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8BF8DE 0%, #2cb99d 100%);
    border-radius: 1px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background-color: #8BF8DE;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    padding-left: calc((100% - 6px) / 8);
    padding-right: calc((100% - 6px) / 8);
}

.step-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #e9ecef;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.step-dot.active {
    background-color: #8BF8DE;
    transform: scale(1.2);
}

.step-dot.completed {
    background-color: rgb(184, 255, 241);
}

/* Minimalistic Tab Navigation */
.minimal-tabs {
    display: flex;
    justify-content: space-between;
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-btn {
    flex: 1;
    background: #ffffff;
    color: #495057;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #49efce42;
    opacity: 0;
    border-radius: 0.5rem;
    transition: opacity 0.2s ease;
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-btn:hover:not(.active)::before {
    opacity: 1;
    background: #49efce1a;
}

.tab-number {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    transition: color 0.2s ease;
    position: relative;
    z-index: 1;
}

.tab-label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    transition: color 0.2s ease;
    position: relative;
    z-index: 1;
}

.tab-btn.active .tab-number,
.tab-btn.active .tab-label {
    color: #0D3049;
}

.tab-btn:hover:not(.active) .tab-number,
.tab-btn:hover:not(.active) .tab-label {
    color: #0D3049;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .minimal-tabs {
        padding: 2px;
    }
    
    .progress-track {
        padding-left: calc((100% - 4px) / 8);
        padding-right: calc((100% - 4px) / 8);
    }
    
    .step-indicators {
        padding-left: calc((100% - 4px) / 8);
        padding-right: calc((100% - 4px) / 8);
    }
    
    .tab-btn {
        padding: 6px 8px;
        flex-direction: column;
        gap: 2px;
    }
    
    .tab-number {
        font-size: 11px;
    }
    
    .tab-label {
        font-size: 10px;
    }
}

/* Card styling */
.card {
    margin-bottom: 1rem;
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: rgba(73, 239, 205, 0.1);
    border-bottom: 1px solid rgba(180, 188, 202, 0.7);
}

/* Sub-categories container styling */
.sub-categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.sub-categories-container .form-check {
    flex: 0 0 calc(50% - 10px);
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .sub-categories-container .form-check {
        flex: 0 0 100%;
    }
}

/* Validation styling */
.is-invalid {
    border-color: #dc3545 !important;
}

.invalid-feedback {
    display: block !important;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    font-weight: 500;
}

.sub-categories-container.is-invalid {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05);
}

.form-check-label.text-danger {
    color: #dc3545 !important;
    font-weight: bold;
}

.btn-outline-primary.border-danger {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}

/* Alert styling */
.alert {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

/* Form text positioning */
.form-text {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.875em;
    color: #64748b;
}

/* Ensure validation messages appear after form-text */
.form-control+.form-text+.invalid-feedback,
.form-select+.form-text+.invalid-feedback {
    margin-top: -0.25rem;
}

/* Help button styling */
.btn-sm .fa-question-circle {
    font-size: 1.2rem;
    color: #1F5D88;
    transition: color 0.2s ease;
}

.btn-sm .fa-question-circle:hover {
    color: #0D3049;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    background: none;
    border: none;
}

.btn-sm:focus {
    box-shadow: none;
}

/* Modal styling */
.modal-content {
    border-radius: 16px;
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.2) !important;
    opacity: 1 !important;
}

.modal-header {
    background-color: rgba(73, 239, 205, 0.1);
    border-bottom: 1px solid rgba(180, 188, 202, 0.7);
}

.modal-title {
    color: #0D3049;
    font-weight: 600;
}

/* Account modal section boxes */
.account-section-box {
    background-color: #f5f5f5;
    border-radius: 12px;
    padding: 1.25rem;
}

/* Nav pills styling - Updated for Modern Look */
/* Remove old card-header specific styling */
.card-body .nav-pills {
    background-color: #f1f5f9; /* Light gray background */
    padding: 0.35rem;
    border-radius: 50rem !important; /* Pill shape */
}

.nav-pills .nav-item {
    margin-right: 0; /* Reset margin for justified tabs */
}

.nav-pills .nav-link {
    color: #64748b;
    font-weight: 600;
    border-radius: 50rem !important;
    padding: 0.6rem 1.2rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-pills .nav-link.active {
    background-color: #ffffff !important;
    color: #0D3049 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-pills .nav-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.6);
    color: #0D3049;
}

/* Tab Content Animation */
.tab-pane {
    animation: fadeIn 0.4s ease-out;
}

/* Floating Form Inputs */
.form-floating > .form-control {
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

/* Fix for floating labels placeholder conflict */
.form-floating .form-control::placeholder {
    color: transparent !important;
}

.form-floating .form-control:focus::placeholder {
    color: #b1b1b2 !important;
}

.form-floating > .form-control:focus {
    background-color: #ffffff !important;
    border-color: #8BF8DE !important;
    box-shadow: 0 0 0 4px rgba(73, 239, 205, 0.15) !important;
}

.form-floating > label {
    color: #94a3b8;
}

/* Social Login Buttons */
#login-google, #login-apple, #register-google, #register-apple {
    border-color: #e2e8f0;
    color: #334155;
    background-color: #ffffff;
    font-weight: 600;
    transition: all 0.2s ease;
}

#login-google:hover, #login-apple:hover, #register-google:hover, #register-apple:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Tab Navigation Styling */
/* Add spacing between card-header with tabs and card-body */
.card-header.bg-white:has(.nav-pills),
.card-header:has(.card-header-pills) {
    margin-bottom: 1rem !important;
}

/* Consistent inner padding for outer elements within each tab pane */
.tab-content .tab-pane > .row > .col-12 > div > div {
    padding: 1rem;
}

.nav-tabs {
    border-bottom: none;
    margin-bottom: 2rem;
}

.nav-tabs .nav-item {
    margin-bottom: -1px;
}

.nav-tabs .nav-link {
    color: #0D3049;
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(73, 239, 205, 0.1);
}

.nav-tabs .nav-link.active {
    color: #0D3049;
    background-color: #fff;
    border-color: rgba(73, 239, 205, 0.5);
}

.tab-content {
    background-color: transparent;
    padding: 0;
    border-radius: 0 0 12px 12px;
}

.tab-pane {
    animation: fadeIn 0.3s ease;
    min-height: 0;
}

/* Ensure consistent top spacing for tab panes to prevent layout jumps */
#authTabsContent .tab-pane {
    padding-top: 0;
}

/* Invoice card styling enhancement */
#invoices-content .card {
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#invoices-content .card-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #2d3748;
    border-bottom: 1px solid rgba(73, 239, 205, 0.3);
    padding-bottom: 0.75rem;
}

/* My Stacks tab styling */
#my-stacks-content .card {
    transition: box-shadow 0.2s ease;
}

#my-stacks-content .card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

#my-stacks-content .card-header {
    padding: 10px;
}

#my-stacks-content .card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

#my-stacks-content .chart-container {
    margin-bottom: 1.5rem;
}

#my-stacks-content .h2 {
    margin-top: 0.5rem;
    margin-bottom: 0;
    color: #1F5D88;
    font-weight: 700;
}

/* More habits button styling */
.more-habits {
    color: #1F5D88;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
}

.help-content ul {
    padding-left: 1.5rem;
}

.help-content p {
    margin-bottom: 1rem;
}

.help-content p+ul {
    margin-top: 0;
}

.help-content .list-title {
    margin-bottom: 0.4rem;
    font-weight: 500;
}

/* Stack accordion styles in My Stacks tab */
.accordion-button:not(.collapsed) {
    box-shadow: none;
}
  
.accordion-item {
    border: 1px solid rgba(0,0,0,0.125);
    border-radius: 0.5rem !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
  
.accordion-button {
    border-radius: 0.5rem;
}
  
.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0, 0, 0, 0.125);
}

/* Accordion toggle button chevron rotation */
.accordion-toggle-btn[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Accordion title area styling */
.accordion-title-area {
    cursor: pointer;
    user-select: none;
}

.accordion-title-area:hover {
    opacity: 0.8;
}
  
/* Edit button styles for stack accordion */
.edit-stack-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    z-index: 10;
    position: relative;
}

.edit-stack-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.edit-stack-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.edit-stack-btn .fas {
    margin-right: 0.25rem;
}

/* Ensure edit button container doesn't interfere with accordion */
.accordion-button .d-flex {
    pointer-events: none;
}

.accordion-button .edit-stack-btn {
    pointer-events: all;
}
  
/* Improve readability of stack content */
.accordion-body {
    max-height: none;
    overflow: visible;
}
  
.accordion-body .card {
    margin-bottom: 1rem;
}
  
.accordion-body .card-header {
    padding: 0.5rem 1rem;
}
  
.accordion-body .card-body {
    padding: 0.75rem 1rem;
}
  
.accordion-body .row p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
  
.accordion-body .border.rounded {
    max-height: 200px;
    overflow-y: auto;
}

/* Stack detail labels and text styling */
.stack-detail-label {
    font-weight: 500;
    color: #212529;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.25rem;
}

.stack-detail-text {
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #495057;
}

/* Styles for habit accordion items */
.habit-accordion-item .card {
    border: 1px solid #dee2e6;
    box-shadow: none;
    transition: border-color 0.2s ease;
    transform: none !important;
    overflow: hidden;
}

.habit-accordion-item .card:hover {
    transform: none !important;
    border-color: #adb5bd;
    box-shadow: none;
}

.habit-accordion-item .btn-link {
    color: #212529;
    padding: 0.5rem;
}

.habit-accordion-item .btn-link:hover {
    color: #0D6EFD;
}

.habit-accordion-item .btn-link:focus {
    box-shadow: none;
}

.habit-accordion-item .btn-link .fas {
    transition: transform 0.2s ease;
}

.habit-accordion-item .btn-link:not(.collapsed) .fas {
    transform: rotate(180deg);
}

/* Prevent scrolling on habit card body */
.habit-accordion-item .card-body {
    overflow: visible;
    max-height: none;
    padding: 1rem;
}

/* Style habit card header */
.habit-accordion-item .card-header {
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-top: none;
}

.habit-accordion-item .card-header:first-child {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

/* Habit card header improvements */
.habit-accordion-item .card-header h6 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.habit-accordion-item .card-header .btn-link {
    font-weight: 600;
    align-items: flex-start;
}

.habit-accordion-item .card-header .btn-link:hover {
    color: #0D6EFD;
    background-color: transparent;
}

.habit-accordion-item .card-header .btn-link .flex-grow-1 {
    min-width: 0;
}

.habit-accordion-item .card-header .text-muted.small {
    display: block;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-top: 0.25rem;
    font-weight: 400;
}

/* Clean up habit card content design */
.habit-accordion-item .card-body .row {
    margin: 0;
}

.habit-accordion-item .card-body .col-md-6 {
    padding: 0.75rem 1rem;
}

.habit-accordion-item .card-body p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.habit-accordion-item .card-body .field-label {
    font-weight: 600;
    color: #495057;
    margin-right: 0.5rem;
}

.habit-accordion-item .card-body .border.rounded {
    max-height: none;
    overflow: visible;
    border: 1px solid #e9ecef !important;
    background-color: #f8f9fa !important;
    padding: 0.75rem !important;
    margin-top: 0.5rem;
}

.habit-accordion-item .card-body .border.rounded small {
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Social media links styling */
.habit-accordion-item .card-body .border.rounded a {
    color: #1F5D88;
    transition: color 0.2s ease;
}

.habit-accordion-item .card-body .border.rounded a:hover {
    color: #0D3049;
    text-decoration: underline;
}

.habit-accordion-item .card-body .border.rounded .d-flex.align-items-center:last-child {
    margin-bottom: 0 !important;
}

/* Social media icon links */
.social-media-icon-link {
    text-decoration: none;
    cursor: pointer;
}

.social-media-icon-link:hover {
    transform: scale(1.15);
    opacity: 0.8;
}

.social-media-icon-link:active {
    transform: scale(1.05);
}

/* Social media URL links in habit cards */
.habit-accordion-item .card-body .border.rounded a[href^="http"] {
    color: #1F5D88;
    transition: color 0.2s ease;
}

.habit-accordion-item .card-body .border.rounded a[href^="http"]:hover {
    color: #0D3049;
    text-decoration: underline;
}

/* Habit Ideas collapse chevron transition */
#habitIdeasChevron {
    transition: transform 0.2s ease;
}

/* How to collapse chevron transition */
#howToChevron {
    transition: transform 0.2s ease;
}

/* Stack Ideas collapse chevron transition */
#stackIdeasChevron {
    transition: transform 0.2s ease;
}

/* Purple alert for stack ideas */
.alert-purple {
    background-color: #f4edfd;
    border-color: #e5d1ff;
    color: #6f42c1;
}

.alert-purple .fas {
    color: #6f42c1;
}

/* Tooltip/Popover button style to match alert-info blue */
.btn-popover-examples {
    background-color: rgba(13, 202, 240, 0.1);
    border: 1px solid rgba(13, 202, 240, 0.3);
    color: #055160;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
    vertical-align: middle;
}

.btn-popover-examples:hover {
    background-color: rgba(13, 202, 240, 0.2);
    border-color: rgba(13, 202, 240, 0.5);
    color: #032830;
}

.d-flex.align-items-center {
    display: flex;
    align-items: flex-end;
    margin-bottom: 0px;
}

/* Ensure proper alignment when button is next to form-text */
.d-flex.align-items-center .form-text {
    display: flex;
    align-items: flex-end;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Make popovers wider in AI stack generation modal */
#aiGenerateStackModal .popover {
    max-width: 650px;
    min-width: 530px;
}

/* Make popovers wider in enter stack page */
body.enter-stack-page .popover {
    max-width: 650px;
    min-width: 530px;
}

/* Make all popover content scrollable when too long */
.popover .popover-body {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Stack status badges */
.accordion-button .badge {
    font-size: 0.8rem;
    padding: 0.35em 0.65em;
    margin-left: 10px;
}

.card-header .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Status colors */
.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Darker warning text color for better contrast */
.text-warning-dark {
    color: #d38818 !important; /* deep orange */
}

/* Stack status badge colors */
.stack-status-badge[data-status="approved"] {
    background-color: #28a745 !important;
    color: white !important;
}
  
.stack-status-badge[data-status="active"] {
  background-color: #28a745 !important;
  color: white !important;
}

.stack-status-badge[data-status="pending"] {
    background-color: #17a2b8 !important;
    color: white !important;
}

.stack-status-badge[data-status="change_request"] {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.stack-status-badge[data-status="rejected"] {
    background-color: #dc3545 !important;
    color: white !important;
}

.stack-status-badge[data-status="unknown"] {
  background-color: #545b62 !important;
  color: white !important;
}

.stack-accordion-header {
  position: relative;
}

.stack-header-content {
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  gap: 1rem;
  position: relative;
}

.stack-header-content::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 33%;
  width: 1px;
  background: linear-gradient(180deg, rgba(13, 48, 73, 0.05), rgba(13, 48, 73, 0.2));
  pointer-events: none;
  z-index: 0;
}

.stack-header-title {
  flex: 0 0 33%;
  max-width: 33%;
  min-width: 220px;
  position: relative;
  z-index: 1;
}

.stack-header-title-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #495057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stack-status-rail {
  position: relative;
  z-index: 1;
  gap: 0.5rem;
  margin-left: 1.5rem;
  flex: 1 1 auto;
  min-width: 220px;
}

.stack-status-step {
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

.stack-status-step-active {
  background-color: #49efceaf !important;
  color: #0D3049 !important;
  box-shadow: 0 0 0 1px rgba(13, 48, 73, 0.1);
}

.stack-status-step-inactive {
  background-color: #c5c9cd !important;
  color: #ffffff !important;
  opacity: 0.85;
}

.stack-header-actions {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.stack-header-actions .edit-stack-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.stack-header-content .accordion-toggle-btn i {
  color: #6c757d;
}

@media (max-width: 991.98px) {
  .stack-header-title {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .stack-header-content::before {
    display: none;
  }

  .stack-status-rail {
    margin-left: 0;
  }

  .stack-header-actions {
    margin-left: auto;
  }
}

/* Accordion field labels */
.field-label {
    font-weight: 600;
    color: #6c757d;
}

/* App Preview Styles */
.mobile-device-frame {
  border: 1px solid #ddd;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: relative;
  max-width: 380px;
  margin: 0 auto;
  font-size: 0.85rem;
}

.app-content-container {
  background-color: #f8f9fa;
  position: relative;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 40px 12px !important;
  scrollbar-width: thin;
}

.preview-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.preview-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.4);
  border-radius: 3px;
}

.stack-header-image {
  height: 80px !important;
  width: 100%;
  object-fit: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.status-bar {
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  font-size: 10px;
}

.preview-section {
  padding-bottom: 20px;
  margin-bottom: 0;
}

.app-navigation-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #0D3049 !important;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 0;
  width: 100%;
  z-index: 10;
  font-size: 0.7rem;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.app-navigation-bar .text-center {
  font-size: 10px;
}

.app-navigation-bar .fas {
  font-size: 16px;
  margin-bottom: 4px;
}

.preview-habit-item {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 8px;
  padding: 8px;
}

.preview-habit-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 0.9rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
}

.popular-tag {
  background-color: #9FFFD5;
  color: #00553e;
  font-size: 0.65rem !important;
  border-radius: 12px;
  padding: 2px 6px;
}

.preview-habit-details {
  display: flex;
  align-items: flex-start;
}

.preview-habit-separator {
  margin: 8px 0 6px 0;
  border: none;
  border-top: 1px solid #e9ecef;
  opacity: 0.6;
}

.preview-how-to {
  color: #4a7db2;
  font-size: 0.75rem !important;
  display: inline-block;
  margin-top: 0;
}

/* Category badge colors */
.category-body {
  background-color: #fad7b3 !important;
}

.category-mind {
  background-color: #d1e7ff !important;
}

.category-relationships {
  background-color: #ffe1e1 !important;
}

.category-growth {
  background-color: #d1ffdd !important;
}

.category-wealth {
  background-color: #fffbd1 !important;
}

/* For smaller screens - position preview at bottom */
@media (max-width: 991px) {
  .preview-column {
    width: 100%;
    max-width: 333px;
    margin: 0 auto;
  }
  
  .preview-container {
    position: static;
    margin-top: 20px;
    margin-bottom: 20px;
    max-height: none;
    width: 100%;
    overflow: visible;
  }
  
  .preview-container .card {
    margin: 0 auto;
  }
  
  .mobile-device-frame {
    border-radius: 24px;
    margin-bottom: 15px;
    height: 700px;
    max-height: 700px;
  }
  
  .app-content-container {
    height: 700px;
  }

  .preview-scroll-container {
    max-height: 425px; /* Less than the container to ensure space for nav */
    padding-bottom: 40px !important;
    overflow-y: auto !important;
  }

  .app-navigation-bar {
    bottom: 0;
    position: absolute;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
  }

  /* Improve preview layout on small screens */
  .preview-section {
    padding-bottom: 20px;
  }
}

/* Improve accordion visibility */
.app-content .accordion-item {
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.1);
}

.app-content .accordion-button {
  padding: 12px 15px;
  background-color: #f8f9fa;
  font-weight: 500;
}

.app-content .accordion-button:not(.collapsed) {
  background-color: #e9ecef;
  color: #0D3049;
}

.app-content .accordion-body {
  padding: 15px;
  background-color: #fff;
  max-height: none;
  overflow: visible;
}

/* Add space between preview elements */
.preview-header {
  margin-bottom: 15px !important;
}

.preview-badges {
  margin-bottom: 15px !important;
  gap: 5px;
}

#preview-description {
  margin-bottom: 15px !important;
}

/* Style preview badges to look more like the app */
.preview-badges .badge {
  border-radius: 20px;
  padding: 6px 12px;
  margin-right: 6px;
  font-size: 0.6rem;
  font-weight: normal;
}

/* Make card header match app design */
.card-header.bg-dark {
  background-color: #0D3049 !important;
  padding: 12px 15px;
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
}

/* App preview card specific styling */
.preview-container .card {
  max-width: 380px;
  margin: 0 auto;
  box-shadow: none !important;
  border: 1px solid #dee2e6 !important;
}

.preview-container .card:hover {
  box-shadow: none !important;
}

/* Make author title more prominent */
#preview-title-large {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
  line-height: 1.3;
  word-wrap: break-word;
}

#preview-author {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 15px;
}

/* Make preview author image smaller */
#preview-author-image-container {
  max-width: 50%;
  margin: 0 auto;
}

#preview-author-image {
  border-radius: 4px;
  max-height: 150px;
  max-width: 100px;
  height: 100%;
  object-fit: cover;
}

/* Independent scrolling for form and preview */
.form-container {
  max-height: 620px;
  overflow-y: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.form-container::-webkit-scrollbar {
  width: 6px;
}

.form-container::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.4);
  border-radius: 3px;
}

/* Override for mobile */
@media (max-width: 991px) {
  .form-container {
    height: auto;
    max-height: none;
    padding-right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Ensure smooth scrolling on iOS */
    position: static;
  }
  
  html, body {
    overflow-y: auto !important;
    height: auto !important;
    position: static !important;
    overscroll-behavior-y: auto;
  }
  
  .container-fluid, .row, .col-12, .col-lg-6 {
    overflow: visible !important;
  }
}

.preview-column {
  width: 360px;
  flex-shrink: 0;
}

body.enter-stack-page .preview-column {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

body.enter-stack-page .preview-container {
  position: relative;
  top: 0;
  height: 100%;
  max-height: 100%;
  overflow: visible;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 60px;
}

body.enter-stack-page .preview-container > .card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  box-shadow: none !important;
  border: 1px solid #dee2e6 !important;
}

body.enter-stack-page .preview-container .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

body.enter-stack-page .preview-container .mobile-device-frame {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}

body.enter-stack-page .preview-container .status-bar {
  flex-shrink: 0;
}

body.enter-stack-page .preview-container .app-content-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: 100% !important;
  position: relative;
  overflow: hidden;
  padding-bottom: 0;
  margin-bottom: 0;
}

body.enter-stack-page .preview-container .preview-scroll-container {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 50px 12px !important;
}

body.enter-stack-page .preview-container .app-navigation-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.preview-container {
  position: relative;
  top: 15px;
  max-height: 700px;
  overflow: visible;
  width: 100%;
  margin: 0 auto;
}

.preview-container .preview-scroll-container {
  max-height: 650px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-bottom: 40px !important;
}

.preview-container .preview-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.preview-container .preview-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.4);
  border-radius: 3px;
}

/* Scroll behavior and focus indicators */
.form-container:focus-within {
  outline: none;
}

.preview-scroll-container:focus-within {
  outline: none;
}

/* Make scrollbars more visible on hover */
.form-container:hover::-webkit-scrollbar-thumb,
.preview-scroll-container:hover::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.6);
}

/* Add some padding to the app content for better readability */
.app-content {
  padding: 15px !important;
}

.preview-stack-mini .card {
  background-color: #f8f9fa;
  transition: all 0.2s ease;
  box-shadow: none !important;
  border: 1px solid #dee2e6 !important;
}

.preview-stack-mini .card:hover {
  background-color: #f0f4f8;
  box-shadow: none !important;
}

.preview-stack-mini h6 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.preview-mini-badges {
  margin-top: 8px;
}

.preview-section-divider {
  border-radius: 8px;
  margin: 20px 0 10px;
}

.preview-section-divider h5 {
  color: #0D3049;
  font-size: 18px;
  margin-bottom: 0;
}

/* Preserve line breaks for text in preview */
#preview-description,
#preview-about-author,
#preview-core-concept,
#preview-unique-ideas li,
#preview-mini-motivation {
  white-space: pre-line;
}

#preview-unique-ideas {
  padding-left: 0;
}

#preview-unique-ideas li {
  list-style: none;
  position: relative;
  padding-left: 1.2em;
  margin-bottom: 6px;
}

#preview-unique-ideas li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #000;
}

/* Responsive adjustments for 380px max-width */
@media (max-width: 380px) {
  .preview-badges .badge {
    font-size: 0.55rem;
    padding: 0.2em 0.5em;
  }
  
  #preview-title-large {
    font-size: 0.9rem;
  }
  
  #preview-author {
    font-size: 0.8rem;
  }
  
  #preview-mini-motivation {
    max-width: 150px;
  }
  
  #preview-mini-image {
    height: 75px !important;
    aspect-ratio: 133 / 200 !important;
    width: auto !important;
  }
}

/* Ensure form is more compact on mobile */
@media (max-width: 767px) {
  .app-content-container {
    height: auto;
    min-height: 500px;
    max-height: 600px;
  }

  .app-content-container, 
  .preview-scroll-container {
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  .mobile-device-frame {
    overflow: hidden;
  }

  .preview-container .card-body {
    padding: 0;
  }
  
  /* Ensure body scrolls properly */
  html, body {
    overflow-y: auto !important;
    height: auto !important;
    position: relative !important;
  }
  
  .container-fluid {
    overflow: visible !important;
  }
  
  .row {
    overflow: visible !important;
  }
}

/* Mobile preview toggle button */
.preview-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Mobile preview container */
.preview-container-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.9);
  z-index: 1001;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Ensure smooth scrolling on iOS */
}

.preview-container-mobile.show {
  display: flex;
}

/* Make the preview container scrollable on mobile */
.preview-container-mobile .app-content-container {
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Make all preview fonts smaller */
.mobile-device-frame {
  font-size: 0.85rem;
}

/* Heading sizes in preview */
.preview-scroll-container h2 {
  font-size: 1.2rem;
}

.preview-scroll-container h5,
.preview-scroll-container h6 {
  font-size: 0.9rem;
}

/* Author text and other paragraphs */
#preview-author {
  font-size: 0.9rem;
}

.preview-scroll-container p,
.preview-scroll-container small {
  font-size: 0.8rem;
}

/* Badge text */
.preview-badges .badge {
  font-size: 0.6rem;
  padding: 4px 8px;
}

/* Habit items */
.preview-habit-item h6 {
  font-size: 0.85rem;
}

.preview-habit-item small,
.preview-how-to {
  font-size: 0.75rem !important;
}

.popular-tag {
  font-size: 0.65rem !important;
  padding: 2px 6px;
}

/* Preview habit icon size */
.preview-habit-icon {
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
}

/* Navigation bar at bottom */
.app-navigation-bar {
  font-size: 0.7rem;
}

.app-navigation-bar .fas {
  font-size: 16px;
}

/* Accordion buttons */
.preview-scroll-container .accordion-button {
  font-size: 0.85rem;
  padding: 8px 12px;
}

.preview-scroll-container .accordion-body {
  font-size: 0.8rem;
  padding: 10px;
}

/* Status bar */
.status-bar {
  font-size: 10px;
}

/* Mini card in preview */
.preview-stack-mini h6 {
  font-size: 0.85rem;
}

.preview-mini-badges .badge {
  font-size: 0.65rem;
  padding: 3px 6px;
}

/* Unique ideas bulleted list */
#preview-unique-ideas li {
  font-size: 0.8rem;
  margin-bottom: 6px;
}

/* Stack header spacing */
.preview-header {
  margin-bottom: 15px !important;
}

/* Reduce the height of the header image */
.stack-header-image {
  height: 150px !important;
  border-radius: 12px 12px 0 0;
}

/* Spacing between elements */
.preview-badges {
  margin-bottom: 15px !important;
  gap: 5px;
}

#preview-description {
  margin-bottom: 15px !important;
}

/* Habit item spacing */
.preview-habit-item {
  padding: 8px;
  margin-bottom: 8px;
}

/* Space between sections */
.preview-section-divider {
  margin: 20px 0 10px;
}

/* Mini card padding */
.preview-stack-mini .card-body {
  padding: 8px !important;
}

/* Habit containers spacing */
.preview-habits-container {
  margin-bottom: 15px;
}

/* Section title margin */
.preview-scroll-container h6 {
  margin-bottom: 5px;
}

/* Preview Habit Modal Styles */
.preview-habit-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.preview-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
}

.preview-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 95%;
  width: 320px;
  max-height: 80%;
  overflow: hidden;
  z-index: 1001;
}

.preview-modal-header {
  display: flex;
  justify-content: between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #e9ecef;
  background-color: #f8f9fa;
}

.preview-modal-header h6 {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
}

.preview-modal-close {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 8px;
}

.preview-modal-close:hover {
  color: #495057;
}

.preview-modal-body {
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.7rem;
}

.preview-modal-section {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 8px;
  font-size: 0.65rem;
  line-height: 1.4;
}

.preview-modal-footer {
  padding: 8px 12px;
  border-top: 1px solid #e9ecef;
  background-color: #f8f9fa;
  text-align: center;
}

.preview-modal-btn {
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.7rem;
  cursor: pointer;
}

.preview-modal-btn:hover {
  background-color: #5a6268;
}

/* Draft Load Modal Styling - matches draft conflict modal */
#draftLoadModal .modal-dialog {
  max-width: 800px;
}

#draftLoadModal .modal-content {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#draftLoadModal .modal-header {
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

#draftLoadModal .modal-footer {
  border-top: none;
  padding: 1.5rem;
}

#draftLoadModal .alert {
  margin-bottom: 1rem;
}

#draftStackTitle {
  background: #f8f9fa;
  margin-top: 0.5rem;
  padding: 0.5rem;
  text-align: left;
  display: inline-block;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(73, 239, 205, 0.1);
}

#draftStackTitleText {
  color: #0D3049 !important;
  font-size: 1.1rem !important;
  word-break: break-word;
}

/* Form Labels - Smaller and Bolder */
.form-label {
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  color: #495057 !important;
  margin-bottom: 6px !important;
}

/* Habit Input Cards */
.habit-input-card {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.habit-input-card:hover {
  border-color: #adb5bd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.habit-input-card .habit-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 0px !important;
  min-height: 32px;
}

.habit-input-card .habit-header.d-flex.align-items-center {
  align-items: center !important;
  margin-bottom: 0px !important;
}

.habit-input-card .habit-number {
  font-weight: 700;
  color: #495057;
  font-size: 0.875rem;
}

.habit-input-card .remove-habit-btn {
  color: #dc3545;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.habit-input-card .remove-habit-btn:hover {
  color: #c82333;
  background-color: rgba(220, 53, 69, 0.1);
  border-radius: 4px;
}

/* Expert Profile Header Tile */
.expert-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  user-select: none;
}

.expert-profile-header:hover {
  background-color: #f6fbff;
  border-color: #adb5bd;
}

.expert-profile-header:active {
  background-color: #dee2e6;
}

.expert-profile-header h6 {
  margin: 0;
  font-weight: 600;
  color: #495057;
}

.expert-profile-header .form-label {
  margin-bottom: 0 !important;
}

.expert-profile-header i {
  color: #6c757d;
  transition: transform 0.3s ease;
  font-size: 14px;
}

/* AI Generate Stack Button Styling */
#submit-ai-generate-btn {
  background: linear-gradient(135deg, #84dbf4 0%, #b1abff 100%) !important;
  border: none !important;
  transition: all 0.3s ease;
}

#submit-ai-generate-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #84dbf4 0%, #b1abff 100%) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#submit-ai-generate-btn:disabled {
  background: linear-gradient(135deg, #89a7af 0%, #b7b6cb 100%) !important;
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

#submit-ai-generate-btn:disabled:hover {
  background: linear-gradient(135deg, #89a7af 0%, #b7b6cb 100%) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Multiple Drafts Modal Styles */
.draft-option {
  transition: all 0.2s ease;
  border-color: #dee2e6 !important;
}

.draft-option:hover {
  border-color: #8BF8DE !important;
  box-shadow: 0 0.5rem 1rem rgba(73, 239, 205, 0.2);
}

.draft-option.selected {
  border-color: #8BF8DE !important;
  border-width: 2px !important;
  background-color: rgba(73, 239, 205, 0.08);
  box-shadow: 0 0 0 0.2rem rgba(73, 239, 205, 0.25);
}

.delete-draft-btn {
  border: none !important;
  padding: 0.25rem 0.5rem !important;
}

.delete-draft-btn:hover {
  background-color: #dc3545 !important;
  color: white !important;
}

/* Burger Menu Styling */
.user-menu-btn {
  padding: 8px 16px !important;
  border-radius: 12px !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.user-menu-btn:hover {
  background-color: #49efce37 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.user-menu-btn:active {
  transform: translateY(0) !important;
}

.user-menu-btn:focus {
  box-shadow: 0 0 0 0.25rem rgba(73, 239, 205, 0.25) !important;
}

/* User Menu Dropdown */
.user-menu-dropdown {
  border: none !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08) !important;
  padding: 12px !important;
  margin-top: 12px !important;
  min-width: 240px !important;
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* User Menu Items */
.user-menu-item {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 14px 16px !important;
  border-radius: 12px !important;
  transition: all 0.2s ease !important;
  color: #0D3049 !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  margin-bottom: 6px !important;
  background-color: transparent !important;
  border: none !important;
  width: 100% !important;
  text-align: left !important;
}

.user-menu-item i {
  width: 24px !important;
  height: 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: rgba(139, 248, 222, 0.15) !important;
  border-radius: 8px !important;
  color: #109898 !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.user-menu-item:hover {
  background-color: rgba(73, 239, 205, 0.08) !important;
  transform: translateX(2px) !important;
  color: #0D3049 !important;
}

.user-menu-item:hover i {
  background-color: rgba(139, 248, 222, 0.25) !important;
  color: #0D3049 !important;
  transform: scale(1.05) !important;
}

.user-menu-item:active {
  transform: translateX(0) !important;
}

/* Logout item special styling */
.logout-item {
  color: #dc3545 !important;
}

.logout-item i {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #dc3545 !important;
}

.logout-item:hover {
  background-color: rgba(220, 53, 69, 0.08) !important;
  color: #c82333 !important;
}

.logout-item:hover i {
  background-color: rgba(220, 53, 69, 0.2) !important;
  color: #c82333 !important;
}

/* Divider in dropdown */
.user-menu-dropdown .dropdown-divider {
  margin: 10px 0 !important;
  border-top: 1px solid #e9ecef !important;
  opacity: 0.5 !important;
  border-width: 1px !important;
}

/* Animation for dropdown */
.user-menu-dropdown {
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Partner Guide Modal Styles */
.partner-guide-welcome h2,
.partner-guide-welcome h4,
.dashboard-section-title {
  color: #0D3049;
  font-size: 1.5rem !important;
  font-weight: 600;
  line-height: 1.4;
}

.partner-guide-welcome #partner-guide-name,
.partner-guide-welcome #partner-guide-name-embedded {
  color: #109898 !important;
  font-weight: 700;
}

/* Commission Cards */
.commission-card {
  background-color: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.commission-header {
  flex-shrink: 0;
  margin-bottom: 1.5rem;
}

.commission-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* OR Separator */
.or-separator {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 1rem 0;
}

.or-text {
  background-color: #ffffff;
  color: #64748b;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.or-separator::before,
.or-separator::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 50%;
  background-color: #e2e8f0;
}

.or-separator::before {
  top: 0;
}

.or-separator::after {
  bottom: 0;
}

.commission-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.expert-stack-card {
  border-color: #8BF8DE;
  background: linear-gradient(135deg, #ffffff 0%, #f0fff983 100%);
  min-height: 100%;
}

.simple-promo-card {
  border-color: #B4BCCA;
  background-color: #f8fafc;
  min-height: 100%;
}

.commission-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0D3049;
  margin-bottom: 1rem;
}

.commission-body {
  font-size: 1rem;
  line-height: 1.6;
}

.commission-rate {
  font-size: 1rem;
  color: #0D3049;
}

.early-partner-badge {
  background-color: #8BF8DE !important;
  color: #0D3049 !important;
  font-size: 0.875rem;
  padding: 0.4em 0.8em;
  border-radius: 20px;
  font-weight: 600;
}

.tier-badge-large {
  font-size: 0.75rem;
  padding: 0.5em 0.9em;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tier-badge-expert {
  background: linear-gradient(135deg, #b7b2fd 0%, #928bfa 100%) !important;
  color: #ffffff !important;
  border: none !important;
}

.tier-badge-promo {
  background-color: #109898 !important;
  color: #ffffff !important;
  border: none !important;
}

.expert-benefits-highlight {
  background-color: rgba(73, 239, 206, 0.1);
  padding: 0.75rem;
  border-radius: 6px;
  margin-top: 0.5rem;
}

.expert-benefits-highlight,
.expert-benefits-highlight small,
.expert-benefits-highlight .text-muted {
  color: #0D3049 !important;
}

.partner-guide-link {
  color: #1F5D88;
  font-weight: 600;
  text-decoration: underline;
}

.partner-guide-link:hover {
  color: #0D3049;
}

/* Why Create Stack Section */
.why-create-stack-section {
  background-color: #f8fafc;
  border: none;
  border-radius: 16px;
  padding: 1.25rem;
}

.why-create-stack-section h4 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0D3049;
  margin: 0;
}

/* Benefit Cards */
.benefit-card {
  background-color: #ffffff;
  /* Border handled by utility classes or default */
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Changed from space-between to allow natural flow */
  width: 100%;
  position: relative;
  overflow: visible; /* Ensure badge is visible */
}

.benefit-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

.benefit-icon {
  font-size: 2rem;
  color: #8BF8DE;
  margin-bottom: 1rem;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.benefit-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0D3049;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.benefit-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #109898;
  margin-top: 1rem;
  line-height: 1;
}

.benefit-emoji {
  font-size: 2.5rem;
  margin-top: 1rem;
  line-height: 1;
}

.benefit-description {
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.5;
  flex-grow: 0;
}

.benefit-badge {
  background-color: #8BF8DE !important;
  color: #0D3049 !important;
  font-size: 0.75rem;
  padding: 0.5em 1em;
  border-radius: 20px;
  font-weight: 700;
  position: absolute;
  top: -0.8rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Dashboard specific benefit card styling to match step cards */
.dashboard-benefit-card {
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 1rem !important;
  box-shadow: none !important;
}

.dashboard-benefit-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
  border-color: #8BF8DE !important;
}

.dashboard-benefit-card .benefit-value,
.dashboard-benefit-card .benefit-emoji {
  font-size: 2rem;
}

.dashboard-benefit-card .benefit-title {
  font-size: 0.9rem;
}

.dashboard-benefit-card .benefit-description {
  font-size: 0.85rem;
}

/* Simple Steps Section */
.simple-steps-section {
  background-color: #f8fafc;
  border-radius: 16px;
  padding: 1.25rem;
}

.simple-steps-section h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0D3049;
}

.simple-steps-section .subtitle {
  font-size: 1rem;
  font-weight: 500;
  color: #64748b;
}

/* Step Cards */
.step-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border-color: #8BF8DE;
}

.step-number {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  background: rgba(73, 239, 206, 0.188);
  color: #0D3049;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 50%;
  border: 1px solid #3a45432c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon {
  font-size: 2rem;
  color: #8BF8DE;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-image {
  width: 74px !important;
  height: 74px !important;
  object-fit: contain;
  max-width: 74px;
  max-height: 74px;
}

.step-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0D3049;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  flex-grow: 1;
}

.step-time {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
  margin-top: auto;
}

.step-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #1F5D88;
  font-weight: 600;
  text-decoration: underline;
  font-size: 0.875rem;
}

.step-link:hover {
  color: #0D3049;
}

/* Partner Guide Got it Button */
#partner-guide-got-it-btn {
  padding: 0.75rem 3rem;
  font-size: 1.125rem;
  font-weight: 700;
  border-radius: 12px;
  width: 100%;
  max-width: 300px;
}

/* Responsive adjustments for Partner Guide */
@media (max-width: 991px) {
  .partner-guide-welcome h2,
  .partner-guide-welcome h4 {
    font-size: 1.125rem;
  }
  
  .or-separator {
    display: none;
  }
}

@media (max-width: 767px) {
  /* Stack Tabs Vertically on Mobile */
  #authTabs.nav-pills {
    flex-direction: column;
    background-color: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    gap: 10px;
  }

  #authTabs .nav-item {
    margin: 0;
    width: 100%;
  }

  #authTabs .nav-link {
    width: 100%;
    background-color: #eef2f6;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 50rem !important;
  }

  #authTabs .nav-link.active {
    background-color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }

  /* Typography adjustments */
  .partner-guide-welcome h2,
  .partner-guide-welcome h4 {
    font-size: 1.125rem;
  }
  
  .commission-header h3,
  .simple-steps-section h3,
  .why-create-stack-section h4 {
    font-size: 1rem;
  }
  
  /* Optimize Benefit Cards Grid */
  .benefit-cards-row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
  }
  
  .benefit-card {
    padding: 1rem 0.75rem;
    border-radius: 12px;
    min-height: 0; /* Allow shrinking */
  }

  .benefit-icon {
    font-size: 1.5rem;
    height: 30px;
    margin-bottom: 0.5rem;
  }

  .benefit-title {
    font-size: 0.8rem;
    min-height: 2.5em; /* Align titles (approx 2 lines) */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 0.5rem;
    line-height: 1.2;
  }

  .benefit-description {
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 0.5rem !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .benefit-value,
  .benefit-emoji {
    font-size: 1.5rem;
    margin-top: auto;
  }

  .benefit-badge {
    font-size: 0.6rem;
    padding: 0.3em 0.8em;
    top: -0.6rem;
  }
  
  .step-card {
    min-height: auto;
  }
}

/* Image Upload - Drag and Drop Styles */
.image-drop-zone {
  position: relative;
  width: 118px;
  height: 170px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.image-drop-zone:hover {
  transform: translateY(-2px);
}

.image-drop-zone.dragover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(73, 239, 205, 0.3);
}

.image-preview-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ddd;
  transition: all 0.3s ease;
}

.image-preview:hover {
  border-color: #8BF8DE;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  transition: all 0.3s ease;
  text-align: center;
  padding: 1rem;
}

.image-placeholder i {
  color: #8BF8DE;
  transition: transform 0.3s ease;
}

.image-placeholder p {
  font-size: 0.75rem;
  line-height: 1.2;
}

.image-drop-zone:hover .image-placeholder {
  border-color: #8BF8DE;
  background-color: rgba(73, 239, 205, 0.05);
}

.image-drop-zone:hover .image-placeholder i {
  transform: translateY(-3px);
}

.image-drop-zone.dragover .image-placeholder {
  border-color: #8BF8DE;
  background-color: rgba(73, 239, 205, 0.1);
  border-style: solid;
}

.image-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #94a3b8;
  color: white;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-remove-btn:hover {
  background-color: #ef4444;
  transform: scale(1.1);
}

.image-remove-btn:active {
  background-color: #dc2626;
  transform: scale(0.95);
}

/* Promo code blur effect for inactive codes */
.promo-code-blurred {
  filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
  color: transparent !important;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
  background-color: #e9ecef !important;
}

.promo-code-blurred::selection {
  background: transparent;
}

.promo-code-blurred::-moz-selection {
  background: transparent;
}

/* Hide the copy button when promo code is blurred */
.input-group:has(.promo-code-blurred) button {
  display: none;
}

/* Modern Promo Code Cards */
.promo-code-card {
  background-color: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 0;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.promo-code-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.promo-partner-card {
  border-color: #B4BCCA;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.expert-partner-card {
  border-color: #8BF8DE;
  background: linear-gradient(180deg, #ffffff 0%, #f0fff9 100%);
}

.promo-code-card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  min-height: 72px;
  display: flex;
  align-items: center;
}

.promo-code-card-header > div {
  width: 100%;
}

.promo-code-card-header h5 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0D3049;
  margin: 0;
}

.promo-commission-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.promo-commission-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.promo-commission-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0D3049;
  line-height: 1.2;
}

.promo-commission-extra {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 0.15rem;
}

.promo-code-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.promo-icon {
  background: linear-gradient(135deg, #109898 0%, #0d7a7a 100%);
  color: #ffffff;
}

.expert-icon {
  background: linear-gradient(135deg, #b7b2fd 0%, #928bfa 100%);
  color: #ffffff;
}

.promo-code-card-body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.promo-code-input {
  border-radius: 8px 0 0 8px;
  border: 2px solid #e2e8f0;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
}

.promo-code-input:focus {
  border-color: #109898;
  box-shadow: 0 0 0 0.2rem rgba(16, 152, 152, 0.1);
}

.promo-copy-btn {
  border-radius: 0 8px 8px 0;
  border: 2px solid #e2e8f0;
  border-left: none;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

.promo-copy-btn:hover {
  background-color: #109898;
  border-color: #109898;
  color: #ffffff;
}

.promo-code-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1rem;
  background-color: rgba(226, 232, 240, 0.3);
  border-radius: 12px;
  margin-top: 0.5rem;
}

.promo-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

.promo-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.promo-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0D3049;
}

.promo-status-active {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: rgba(16, 152, 152, 0.1);
  border-radius: 8px;
  color: #109898;
  font-weight: 600;
}

#promo-code-valid-until,
#expert-code-valid-until {
  padding-left: 1.5rem;
  padding-bottom: 0.2rem;
}

.promo-status-info {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  background-color: rgba(73, 239, 206, 0.1);
  border-radius: 8px;
  color: #374151;
  gap: 0.75rem;
}

.promo-status-pending {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  background-color: rgba(245, 158, 11, 0.1);
  border-radius: 8px;
  color: #f59e0b;
  gap: 0.75rem;
}

.promo-activate-btn {
  border-radius: 50rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.promo-activate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 152, 152, 0.3);
}

@media (max-width: 768px) {
  .promo-code-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .promo-code-card-header {
    padding: 1rem 1.25rem;
    min-height: auto;
  }
  
  .promo-code-card-header > div {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }
  
  .promo-commission-display {
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }
  
  .promo-code-card-body {
    padding: 1.25rem;
  }
}

/* Character counter spacing */
[id$="Count"] {
    margin-left: 0.25rem;
}

/* Bottom-align Info button next to form-text */
.d-flex.align-items-center .btn-popover-examples {
    align-self: flex-end;
}

/* Habit view: bottom-align form-text and Info button */
.habit-form .form-text {
  margin-bottom: 0;
}
.habit-form .d-flex.align-items-center {
    align-items: flex-end;
}
.habit-form .d-flex.align-items-center .form-text {
    align-items: flex-end;
}
.habit-form .d-flex.align-items-center .btn-popover-examples {
    align-self: flex-end;
}

/* Habit view alignment to match stack language/translations */
.habit-form .d-flex.align-items-center {
    align-items: center;
}
.habit-form .d-flex.align-items-center .btn-popover-examples {
    align-self: auto;
}

/* Habit form collapsed state - rounded corners on card-header when body is collapsed */
.habit-form.card:has(.habit-card-body.collapsed) .card-header {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* Ensure card has proper border radius and overflow when collapsed */
.habit-form.card:has(.habit-card-body.collapsed) {
    border-radius: 16px;
    overflow: hidden;
}

/* Habit form expanded state - rounded corners on card-body when expanded */
.habit-form.card:not(:has(.habit-card-body.collapsed)) .habit-card-body {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* Ensure card has proper border radius when expanded */
.habit-form.card:not(:has(.habit-card-body.collapsed)) {
    border-radius: 16px;
    overflow: hidden;
}

/* Fix dropdown menu being cut off in stacks overview table */
#stacks-overview-container .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

#stacks-overview-container .table-responsive .dropdown-menu {
    position: absolute;
    z-index: 1050;
}

#stacks-overview-container .dropdown {
    position: static;
}

/* Visual distinction for promo vs expert tier purchases and commissions */
.table-info {
    background-color: rgba(16, 152, 152, 0.1) !important;
    border-left: 3px solid #109898;
}

.table-success {
    background-color: rgba(146, 139, 250, 0.1) !important;
    border-left: 3px solid #928bfa;
}

.table-info:hover {
    background-color: rgba(16, 152, 152, 0.15) !important;
}

.table-success:hover {
    background-color: rgba(146, 139, 250, 0.15) !important;
}

/* Tier-based dashboard cards */
.tier-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.tier-header-promo {
    background: linear-gradient(135deg, #109898 0%, #0d7a7a 100%);
    border: none;
    padding: 0.75rem;
}

.tier-header-expert {
    background: linear-gradient(135deg, #b7b2fd 0%, #928bfa 100%);
    border: none;
    padding: 0.75rem;
}

.tier-card .card-body h4 {
    font-weight: 600;
    color: #212529;
}

.tier-card .card-body .text-muted {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cleaner card styling */
.card.border-0.shadow-sm {
    transition: all 0.2s ease;
}

.card.border-0.shadow-sm:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Dashboard spacing improvements */
.partner-performance-dashboard .card-title {
    font-weight: 600;
    color: #212529;
}

.partner-performance-dashboard .display-5,
.partner-performance-dashboard .display-6 {
    font-weight: 700;
}

/* Tier badge icon spacing */
.tier-badge-promo i,
.tier-badge-expert i {
    margin-right: 0.25rem;
}

/* Cleaner table styling */
.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.table thead.table-light th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

/* New Stack Card Design */
.stack-cards-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stack-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
    overflow: hidden;
}

.stack-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.stack-card-header {
    padding: 1rem;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.stack-card.expanded .stack-card-header {
    border-bottom-color: #e2e8f0;
    background-color: #f8fafc;
}

.stack-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0D3049;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stack-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: #64748b;
    font-size: 0.85rem;
    align-items: center;
}

.stack-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stack-meta-item i {
    color: #94a3b8;
}

.stack-status-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25em 0.75em;
    border-radius: 50rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stack-status-pill.status-draft {
    background-color: #e2e8f0;
    color: #475569;
}

.stack-status-pill.status-submitted {
    background-color: #e0f2fe;
    color: #0369a1;
}

.stack-status-pill.status-approved {
    background-color: #dcfce7;
    color: #15803d;
}

.stack-status-pill.status-change_request {
    background-color: #fef3c7;
    color: #b45309;
}

.stack-status-pill.status-rejected {
    background-color: #fee2e2;
    color: #b91c1c;
}

.stack-card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    color: #64748b;
    border: none;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    background-color: #e2e8f0;
    color: #0D3049;
}

.stack-expand-btn {
    transition: transform 0.3s ease;
}

.stack-card.expanded .stack-expand-btn {
    transform: rotate(180deg);
    background-color: #e2e8f0;
    color: #0D3049;
}

.stack-card-body {
    display: none;
    padding: 1.5rem;
    background-color: #ffffff;
}

.stack-card.expanded .stack-card-body {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.stack-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stack-description-text {
    color: #475569;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Enhanced Habit List */
.habit-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.habit-item-card {
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.habit-item-card:hover {
    border-color: #e2e8f0;
    background-color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.habit-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.habit-number-badge {
    width: 24px;
    height: 24px;
    background-color: #e2e8f0;
    color: #64748b;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.habit-item-content {
    flex-grow: 1;
}

.habit-item-title {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.habit-item-meta {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.habit-expand-btn {
    background: none;
    border: none;
    color: #64748b;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.habit-expand-btn:hover {
    color: #334155;
    background-color: #f1f5f9;
    border-radius: 4px;
}

.habit-expand-btn i {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.habit-item-card.expanded .habit-expand-btn i {
    transform: rotate(180deg);
}

.habit-item-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0;
    margin-top: 0;
}

.habit-item-card.expanded .habit-item-body {
    max-height: 2000px;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
}

.habit-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.habit-section-content {
    color: #475569;
    line-height: 1.6;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Send Issue button styling */
#send-commission-issue-btn {
    color: #8B0000 !important;
    background-color: transparent;
    border-color: transparent;
}

#send-commission-issue-btn:hover,
#send-commission-issue-btn:focus {
    color: #8B0000 !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: transparent;
}

#send-commission-issue-btn:active {
    color: #8B0000 !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
    border-color: transparent;
}
