:root {
    /* Colors - Modern Palette */
    --primary: #3b82f6;
    /* Blue 500 */
    --primary-deep: #2563eb;
    /* Blue 600 */
    --primary-light: #60a5fa;
    /* Blue 400 */

    --secondary: #64748b;
    /* Slate 500 */
    --accent: #8b5cf6;
    /* Violet 500 */

    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;

    --surface-color: rgba(255, 255, 255, 0.95);
    --surface-blur: 10px;

    --text-primary: #1e293b;
    /* Slate 800 */
    --text-secondary: #475569;
    /* Slate 600 */

    --border-color: #e2e8f0;
    --border-focus: #3b82f6;

    --error-color: #ef4444;
    --success-color: #10b981;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1.25rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 2px 4px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.3);

    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f0f4ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    line-height: 1.6;
    padding: 40px 20px;
}

h1,
h2,
h3,
h4 {
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary-deep), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

h3 {
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

h3::before {
    content: '';
    display: block;
    width: 6px;
    height: 24px;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    border-radius: 4px;
    margin-right: 12px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background: var(--surface-color);
    backdrop-filter: blur(var(--surface-blur));
    -webkit-backdrop-filter: blur(var(--surface-blur));
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
}

/* Sections */
section {
    display: none;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

section.active {
    display: block;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.required::after {
    content: " *";
    color: var(--error-color);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #fff;
    font-size: 1rem;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.form-control::placeholder {
    color: #94a3b8;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Custom Checkboxes & Radios */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s;
}

.option-item:hover {
    opacity: 0.8;
}

.option-input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: white;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    filter: brightness(1.1);
}

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

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--secondary);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: white;
    color: var(--error-color);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 0.85rem;
    box-shadow: none;
}

.btn-danger:hover {
    background: #fef2f2;
    border-color: var(--error-color);
}

.btn-full {
    width: 100%;
}

/* Selection Page Unique Styles */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.selection-card {
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    background: white;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.selection-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    display: block;
    text-align: center;
}

.selection-card h3::before {
    display: none;
}

/* Reset default h3 style */

.selection-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Dynamic Items */
.dynamic-page-item {
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    background-color: white;
    position: relative;
    transition: var(--transition);
}

.dynamic-page-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.dynamic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.file-upload-box {
    background-image: linear-gradient(45deg, #f8fafc 25%, transparent 25%, transparent 75%, #f8fafc 75%, #f8fafc), linear-gradient(45deg, #f8fafc 25%, transparent 25%, transparent 75%, #f8fafc 75%, #f8fafc);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    border: 2px dashed var(--border-color);
    padding: 2rem;
    text-align: center;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    /* For absolute positioning of input */
}

.file-upload-box:hover {
    border-color: var(--primary);
    background-color: rgba(59, 130, 246, 0.05);
    color: var(--primary);
}

/* Overlay the input to cover the whole box */
.file-upload-box input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* Style the label to look like actionable text */
.file-upload-box label {
    pointer-events: none;
    /* Let clicks pass through to the input */
    position: relative;
    z-index: 1;
}

/* Clean up selector styling if it leaks (though opacity 0 hides it) */
.file-upload-box input[type="file"]::file-selector-button {
    display: none;
}

/* Mobile Polish */
@media (max-width: 600px) {
    body {
        padding: 20px 10px;
    }

    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
    }
}

/* Update Selection Grid to handle featured content */
.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 3rem;
}


/* @media (min-width: 768px) {
  .selection-grid {
    flex-direction: row;
    align-items: stretch;
  }
} (Removed for vertical layout) */


.selection-card {
    flex: 1;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    background: white;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Recommended Style */
.selection-card.recommended {
    border: 2px solid var(--primary);
    background: linear-gradient(to bottom, #ffffff, #f0f9ff);
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 1;
}

.selection-card.recommended:hover {
    transform: scale(1.05);
    box-shadow: 0 25px 50px -12px rgba(37, 99, 235, 0.25);
}

.card-badge {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
    letter-spacing: 1px;
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
}

.selection-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    text-align: left;
    display: inline-block;
}

.card-features li {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-glow {
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Auto-expanding Textarea Style */
textarea.form-control.auto-expand {
    min-height: 46px;
    resize: none;
    overflow-y: hidden;
    height: auto;
    transition: none;
}

/* Page Order Styles */
.page-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem 0.5rem 0;
    border-bottom: 1px dotted var(--border-color);
}

.page-option-row:last-child {
    border-bottom: none;
}

.page-order-input {
    width: 60px;
    padding: 0.25rem 0.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.page-order-input:disabled {
    background-color: #f1f5f9;
    color: #cbd5e1;
    border-color: transparent;
}

/* Validation Errors */
.input-error {
    border: 2px solid #ef4444 !important;
    background-color: #fee2e2 !important;
    /* Slightly darker red tint */
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.error-message-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    z-index: 1000;
    font-weight: bold;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        top: -50px;
        opacity: 0;
    }

    to {
        top: 20px;
        opacity: 1;
    }
}

/* Floating Save Button */
.floating-save-btn {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    z-index: 9999;
    /* Gradient Background for Premium Look */
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 50px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    /* Stronger, glowing shadow */
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5), 0 0 10px rgba(255, 255, 255, 0.2) inset;
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
}

.floating-save-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: floatBounce 3s ease-in-out infinite;
}

.floating-save-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 20px 30px -10px rgba(37, 99, 235, 0.7);
    filter: brightness(1.1);
}

.floating-save-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Icon style enhancement */
.floating-save-btn span {
    font-size: 1.4rem !important;
    background: rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: -0.5rem;
    /* Pull icon slightly left */
    padding-bottom: 2px;
}

@keyframes floatBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

@media (max-width: 600px) {
    .floating-save-btn {
        bottom: 2rem;
        right: 1.5rem;
        padding: 0.9rem 1.8rem;
        font-size: 1rem;
    }
}