/* ============================================================================
   TEMPLATE BRANDING BUILDER - STYLES
   Phase 3: Front End Optimization
   ============================================================================ */

/*
 * TABLE OF CONTENTS
 *
 *  1. Reset & Base Styles
 *  2. Header
 *  3. Two-Panel Layout
 *  4. Alerts, Notifications, Banners & Disclaimers
 *  5. Form Structure
 *  6. Form Fields & Inputs
 *  7. Buttons
 *  8. Preview Actions
 *  9. Template Cards
 * 10. Variation Selector
 * 11. Upload Fields
 * 12. CSS Editor Panel (Bottom Slide)
 * 13. CSS Editor Panel — Controls & Layout
 * 14. Responsive Design
 * 15. Templates Page (templates.php)
 * 16. Landing Page (index.php)
 * 17. Published Templates (published_templates.php)
 * 18. Reference Guide (reference_guide.php)
 * 19. Login Page (login.php)
 * 20. Publish Success Page (publish_success.php)
 */
 
/* ----------------------------------------------------------------------------
   1. RESET & BASE STYLES
   ---------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --primary: #0F172A;
    --primary-light: #1E293B;
    --accent: #3B82F6;
    --accent-dark: #2563EB;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
	--active: #3B82F6;
    
    /* Neutrals */
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    
    /* Typography */
    --font-sans: 'Epilogue', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html {
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Page-specific overrides */
body.page-templates {
    height: auto;
    overflow: auto;
}

html:has(body.page-templates) {
    height: auto;
    overflow: auto;
}


/* ----------------------------------------------------------------------------
   2. TOPBAR
   ---------------------------------------------------------------------------- */
.topbar {
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.4rem 2rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    font-size: 0.82rem;
}

.topbar-welcome {
    color: var(--gray-500);
}

.topbar-welcome strong {
    color: var(--primary);
}

.topbar-link {
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.topbar-logout {
    color: #ef4444;
    border: 1px solid #ef4444;
}

.topbar-logout:hover {
    background: #ef4444;
    color: white;
}

.topbar-login {
    color: #10b981;
    border: 1px solid #10b981;
}

.topbar-login:hover {
    background: #10b981;
    color: white;
}

/* ----------------------------------------------------------------------------
   2. HEADER
   ---------------------------------------------------------------------------- */

.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    max-width: 100%;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

@media (max-width: 768px) {
	.header-content h1 {
		font-size: 1.35rem;
	}
}	

.header p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

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

.header-nav-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 0.85;
}

.header-nav-link:hover {
    opacity: 1;
    background: var(--active);
    color: white;
	border-color: var(--active);
}

.header-nav-link--active {
    background: var(--active);
    color: white;
    border-color: var(--active);
    opacity: 1;
}

.header-nav-link--active:hover {
    background: var(--active);
    border-color: var(--active);
    color: white;
}

.header-nav-link--logout {
    background: #ef4444;
    color: white !important;
    border-color: #ef4444 !important;
    opacity: 1;
}

.header-nav-link--logout:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: white !important;
}

.header-nav-link--login {
    background: #10b981;
    color: white !important;
    border-color: #10b981 !important;
    opacity: 1;
}

.header-nav-link--login:hover {
    background: #059669 !important;
    border-color: #059669 !important;
    color: white !important;
}

/* Mobile Navigation */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: var(--primary);
    font-size: 1.4rem;
    line-height: 1;
}

.mobile-nav {
    display: none;
    flex-direction: column;
    background: white;
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-300);
    padding: 0.75rem 1.5rem;
    gap: 0.5rem;
}

.mobile-nav.open {
    display: flex;
}

.mobile-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.15s;
}

.mobile-nav a:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.mobile-nav a.active {
    background: #eff6ff;
    color: var(--accent);
    font-weight: 600;
}

.mobile-nav .mobile-nav-divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 0.25rem 0;
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .header-nav {
        display: none;
    }

    .header {
        border-bottom: 1px solid var(--gray-300);
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    }
}



/* ----------------------------------------------------------------------------
   3. TWO-PANEL LAYOUT
   ---------------------------------------------------------------------------- */
.main-layout {
    display: grid;
    grid-template-columns: 340px 1fr; 
    flex: 1;
    overflow: hidden;
}

/* Left Panel (Form) */
.left-panel {
    background: white;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    height: calc(100vh - 88px);
    padding-bottom: 50px;
}

.left-panel-content {
    padding: 1.5rem; 
}

/* Right Panel (Preview) */
.right-panel {
    background: var(--gray-100);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.right-panel.editor-open .preview-container {
    padding-bottom: 225px;
}

.preview-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.5rem 2rem;
    flex-shrink: 0;
}

.preview-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.preview-container {
    flex: 0 1 auto;
    max-height: 600px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
}

.preview-frame {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.preview-frame iframe {
    width: 100%;
    height: auto;
    min-height: 400px;
    border: none;
    display: block;
    margin: 0;
    padding: 0;
}

.preview-placeholder {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--gray-400);
}

.preview-placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ----------------------------------------------------------------------------
   4. ALERTS, NOTIFICATIONS, BANNERS & DISCLAIMERS
   ---------------------------------------------------------------------------- */
.alert {
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    position: relative;
    padding-right: 3rem;
}

.alert-success {
    background: var(--success);
}

.alert-error {
    background: var(--error);
}

.alert-danger {
    background: var(--error);
}

.alert .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.alert .btn-close::before {
    content: "✕";
    font-size: 0.9rem;
}

.alert .btn-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.15);
}

.alert strong {
    font-weight: 600;
}

.alert strong {
    font-weight: 600;
}

.alert a {
    color: white;
    text-decoration: underline;
    font-weight: 500;
    margin-left: 0.5rem;
}

.alert a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.alert-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background 0.2s;
}

.alert-link:hover {
    background: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

.alert ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.alert li {
    font-size: 0.85rem;
}

/* Flash Messages (AJAX notifications) */
#flashMessageContainer {
    position: relative;
    z-index: 50;
}

.flash-message {
    margin: 1.5rem;
    padding: 1rem 3rem 1rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

.flash-message.flash-error {
    background: #FEE2E2;
    border: 1px solid #EF4444;
    color: #991B1B;
}

.flash-message.flash-success {
    background: #D1FAE5;
    border: 1px solid #10B981;
    color: #065F46;
}

.flash-message.flash-warning {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    color: #92400E;
}

.flash-message.flash-info {
    background: #EFF6FF;
    border: 1px solid #3B82F6;
    color: #1E40AF;
}

.flash-message strong {
    font-weight: 600;
    display: inline;
}

.flash-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.flash-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.flash-message.flash-dismissing {
    animation: slideUp 0.3s ease-out forwards;
}

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

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}


/* Notice Box — used inside centered card layouts (login, publish
   success, etc.) for error/info messages tied to that single card,
   as opposed to .alert/.flash-message which are page-level banners. */
.notice-box {
    background: #FEE2E2;
    border: 1px solid #EF4444;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
.notice-box ul {
    list-style: none;
    margin: 0;
}
.notice-box li {
    font-size: 0.85rem;
    color: #991B1B;
}
.notice-box li:before {
    content: "❌ ";
}
.notice-box p {
    font-size: 0.85rem;
    color: #991B1B;
    margin: 0;
}
.notice-box p:before {
    content: "❌ ";
}

/* Disclaimer Banner */
.disclaimer-banner {
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    padding: 0.65rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.82rem;
}

.disclaimer-content {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex: 1;
}

.disclaimer-icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.disclaimer-text {
    color: #1e40af;
    line-height: 1.5;
}

.disclaimer-text strong {
    color: #1e3a8a;
}

.disclaimer-close {
    background: none;
    border: none;
    color: #93c5fd;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.disclaimer-close:hover {
    background: #bfdbfe;
    color: #1e40af;
}

/* Demo Disclaimer */
.demo-disclaimer {
    position: relative;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 0.75rem 2rem 0.75rem 0.75rem;
    margin-top: 1rem;
    overflow: hidden;
    font-size: 0.8rem;
}

.demo-disclaimer-content {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.demo-disclaimer-icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.demo-disclaimer-text {
    color: #1e40af;
    line-height: 1.5;
}

.demo-disclaimer-text strong {
    color: #1e3a8a;
}

.demo-disclaimer-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: none;
    border: none;
    color: #93c5fd;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.demo-disclaimer-close:hover {
    background: #bfdbfe;
    color: #1e40af;
}

/* Progress bar */
.demo-disclaimer-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #3b82f6;
    width: 100%;
    transform-origin: left;
    animation: disclaimerCountdown 10s linear forwards;
}

@keyframes disclaimerCountdown {
    from { width: 100%; }
    to   { width: 0%; }
}

/* Mobile Only Banner */
.mobile-only-banner {
    display: none;
    background: #FEE2E2;
    border: 1px solid #EF4444;
    color: #991B1B;
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
    text-align: center;
    font-weight: 500;
}

.mobile-only-banner span {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .mobile-only-banner {
        display: block;
    }
}

/* ----------------------------------------------------------------------------
   5. FORM STRUCTURE
   ---------------------------------------------------------------------------- */
.form-section {
    background: transparent;
    border-radius: 0;
    padding: 0 0 .5rem 0; 
    margin-bottom: 0;
    border: none;
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    margin-bottom: 0.95rem;
    padding-bottom: 0;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    display: block;
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
}

/* ----------------------------------------------------------------------------
   6. FORM FIELDS & INPUTS
   ---------------------------------------------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1rem; 
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.form-label.required::after {
    content: '*';
    color: var(--error);
    margin-left: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--gray-900);
    background: var(--gray-50);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="file"] {
    display: none;
}

/* ----------------------------------------------------------------------------
   7. BUTTONS
   ---------------------------------------------------------------------------- */
.btn-primary {
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
    color: white;
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    font-family: var(--font-sans);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.btn-secondary {
    padding: 0.875rem 1.75rem;
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

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

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-publish {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-publish:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----------------------------------------------------------------------------
   8. PREVIEW ACTIONS (Button Container)
   ---------------------------------------------------------------------------- */
.preview-actions {
    padding: 1.5rem 1.5rem 3rem 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: flex-start;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
}

.preview-actions button {
    flex: 0 0 auto;
    min-width: 280px;
    max-width: 320px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ----------------------------------------------------------------------------
   9. TEMPLATE CARDS
   ---------------------------------------------------------------------------- */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.template-card {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.template-card:hover {
    border-color: var(--accent);
    background: white;
}

.template-card.active {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.template-card.active::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.template-icon-fa {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.template-card[data-template="basic_logo"] .template-icon-fa {
    color: #3B82F6;
}

.template-card[data-template="full_banner"] .template-icon-fa {
    color: #8B5CF6;
}

.template-card[data-template="logo_banner"] .template-icon-fa {
    color: #10B981;
}

.template-card[data-template="max_width"] .template-icon-fa {
    color: #F59E0B;
}

.template-card:hover .template-icon-fa,
.template-card.active .template-icon-fa {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.template-icon {
    display: none;
}

.template-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-900);
}

.template-card[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.template-card[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--gray-900);
    z-index: 10;
    pointer-events: none;
}

/* ----------------------------------------------------------------------------
   10. VARIATION SELECTOR
   ---------------------------------------------------------------------------- */
.variation-group {
    margin-top: .75rem;
    display: none;
}

.variation-group.visible {
    display: block;
}

/* ----------------------------------------------------------------------------
   11. UPLOAD FIELDS
   ---------------------------------------------------------------------------- */

.upload-box {
    border: 2px dashed var(--gray-300);
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
    position: relative;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

.upload-box:hover {
    border-color: var(--accent);
    background: white;
}

.upload-box.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
    padding: 0.5rem;
}

.upload-icon {
    font-size: 1.1rem;
    color: var(--gray-400);
}

.upload-text {
    font-size: 0.8rem;
    color: var(--gray-700);
    font-weight: 500;
}

.upload-hint {
    font-size: 0.72rem;
    color: var(--gray-500);
}

.upload-preview {
    max-width: 100%;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    display: none;
}

.upload-preview.visible {
    display: block;
}

/* Favicon — fixed small square preview */
#faviconPreview {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* When has-file — hide icon/text/hint, show preview stacked above filename */
.upload-box.has-file .upload-icon,
.upload-box.has-file .upload-text,
.upload-box.has-file .upload-hint {
    display: none;
}

.upload-box.has-file .upload-preview.visible {
    display: block;
}

.upload-filename {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    display: none;
    text-align: center;
}

.upload-box.has-file .upload-filename {
    display: block;
}

.upload-box.uploading {
    border-color: var(--accent);
    background: var(--gray-100);
    pointer-events: none;
    opacity: 0.7;
}

.upload-box.uploading .upload-text {
    color: var(--accent);
    font-weight: 600;
}

.upload-box.uploading .upload-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ----------------------------------------------------------------------------
   12. CSS EDITOR PANEL (Bottom Slide)
   ---------------------------------------------------------------------------- */
.css-editor-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 370px;
    background: white;
    border-top: 2px solid var(--gray-300);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.css-editor-panel.open {
    transform: translateY(0);
}

.css-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.css-editor-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--gray-900);
    font-weight: 600;
}

.close-editor {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-editor:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.css-editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* ----------------------------------------------------------------------------
   13. CSS EDITOR PANEL — CONTROLS & LAYOUT
   ---------------------------------------------------------------------------- */

/* ---------- Panel layout ---------- */
.css-editor-panel {
  /* existing slide-up positioning assumed — only adding content styles */
}

.css-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.css-editor-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.publish-from-cep {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.publish-from-cep:hover {
    background: #1d4ed8;
}

.view-published-btn {
    background: #e5e7eb;
    color: #9ca3af;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: not-allowed;
    transition: background 0.2s, color 0.2s;
}

.view-published-btn:not([disabled]) {
    background: #10b981;
    color: #fff;
    cursor: pointer;
}

.view-published-btn:not([disabled]):hover {
    background: #059669;
}

.flash-preview-btn {
    display: inline-block;
    margin-left: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: #059669;
    color: #fff !important;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.flash-preview-btn:hover {
    background: #047857;
}

.reset-editor {
  background: none;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 4px;
  color: var(--gray-500, #6b7280);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  transition: background 0.15s, color 0.15s;
}

.reset-editor:hover {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-700, #374151);
}

/* ---------- Two-column layout ---------- */
.css-editor-content {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100% - 44px);
    padding: 0.4rem 0.75rem;
    align-items: flex-start;
}

.css-editor-content--equal #editorSectionLogoBannerLogo {
    flex: 0 0 calc(50% - 0.5rem);
}

.css-editor-content--equal #editorSectionLogoBannerBanner {
    flex: 0 0 calc(50% - 0.5rem);
}

.editor-column {
    display: flex;
    flex-direction: column;
    gap: 0.025rem;
}

#editorColumnBorder {
    flex: 0 0 40%;
}

#editorSectionLogo {
    flex: 0 0 calc(60% - 1rem);
}

#editorSectionBannerPadding {
    flex: 0 0 calc(60% - 1rem);
}

#editorSectionMWBorder {
    flex: 0 0 calc(50% - 0.5rem);
}

#editorSectionMWControls {
    flex: 0 0 calc(50% - 0.5rem);
}

#editorSectionSCBorder {
    flex: 0 0 calc(50% - 0.5rem);
}

#editorSectionSCControls {
    flex: 0 0 calc(50% - 0.5rem);
}

.editor-section-box {
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 8px;
    padding: 0.5rem;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.editor-section-divider {
    border-top: 0px solid var(--gray-100, #f3f4f6);
    margin: 0.2rem 0;
}

.editor-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-400, #9ca3af);
    margin: 0;
    margin-top: 3px;
    padding-left: 7px;
}

/* ---------- Grid of controls ---------- */
.editor-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
}

.editor-controls-grid--4col {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.control-group--full {
    grid-column: 1 / -1;
}

.control-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
}

/* ---------- Color swatch ---------- */
.color-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 6px;
  padding: 0.2rem 0.3rem;
}

.color-swatch {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
}

.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 4px;
}

.color-hex-display {
  font-size: 0.78rem;
  font-family: 'Courier New', Courier, monospace;
  color: var(--gray-500, #6b7280);
  user-select: all;
}

/* ---------- Select ---------- */
.select-wrapper {
  position: relative;
}

.control-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 6px;
    color: var(--gray-700, #374151);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.6rem 2rem 0.6rem 0.6rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.control-select:focus {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
  outline: none;
}

.select-arrow {
  pointer-events: none;
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--gray-400, #9ca3af);
}

/* ---------- Slider ---------- */
.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-value-display {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary, #3b82f6);
  font-family: 'Courier New', Courier, monospace;
  min-width: 3.5rem;
  text-align: right;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slider-bound {
  font-size: 0.68rem;
  color: var(--gray-400, #9ca3af);
  flex-shrink: 0;
}

.control-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: var(--gray-200, #e5e7eb);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}
.control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.1s;
  cursor: grab;
}
.control-slider::-webkit-slider-thumb:active { transform: scale(1.2); cursor: grabbing; }
.control-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: grab;
}

.slider-track-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--gray-400, #9ca3af);
  margin-top: 0.15rem;
  padding: 0 0.5rem;
}

/* ---------- Card Controls ---------- */
.unit-toggle-group {
    display: inline-flex;
    border: 1px solid var(--gray-400, #9ca3af);
    border-radius: 4px;
    overflow: hidden;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.unit-btn {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border: none;
    background: var(--gray-200, #e5e7eb);
    color: var(--gray-600, #4b5563);
    cursor: pointer;
    transition: background 0.15s;
}

.unit-btn.active {
    background: #16a34a;
    color: #fff;
}

.unit-btn:hover:not(.active) {
    background: var(--gray-300, #d1d5db);
}

/* ---------- Status flash ---------- */
.editor-status {
  text-align: center;
  font-size: 0.72rem;
  color: var(--green-600, #16a34a);
  min-height: 1.2rem;
  padding: 0 1.25rem 0.25rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.editor-status.visible {
  opacity: 1;
}

#mwPreviewInfoBar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #1d4ed8;
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ----------------------------------------------------------------------------
   14. RESPONSIVE DESIGN
   ---------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .right-panel {
        display: none;
    }
    
    .left-panel {
        height: auto;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .css-editor-panel {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ----------------------------------------------------------------------------
   15. TEMPLATES PAGE (templates.php)
   ---------------------------------------------------------------------------- */

body.page-templates {
    height: auto;
    overflow: auto;
}

html:has(body.page-templates) {
    height: auto;
    overflow: auto;
}

.tm-layout {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Toolbar */
.tm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.tm-toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.tm-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.tm-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tm-stat {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.tm-stat-divider {
    color: var(--gray-300);
    font-size: 0.85rem;
}

.tm-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tm-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    pointer-events: none;
}

.tm-search {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    width: 260px;
    font-family: var(--font-sans);
    color: var(--gray-700);
    outline: none;
    transition: border-color 0.2s;
    background: white;
}

.tm-search:focus {
    border-color: var(--accent);
}

/* Table */
.tm-table-wrapper {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
}

.tm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tm-table thead tr {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.tm-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.tm-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

.tm-table tbody tr:last-child {
    border-bottom: none;
}

.tm-table tbody tr:hover {
    background: var(--gray-50);
}

.tm-table td {
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    vertical-align: middle;
}

/* Group separator */
.tm-group-first td {
    border-top: 2px solid var(--gray-200);
}

.tm-table tbody tr:first-child.tm-group-first td {
    border-top: none;
}

/* Customer ID column */
.tm-col-custid {
    width: 130px;
}

.tm-custid-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}


.tm-custid-repeat {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}
/* .tm-custid-repeat {
    display: inline-block;
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
} */

/* Portal column */
.tm-portal-name {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

/* Type badge */
.tm-type-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: #eff6ff;
    color: var(--accent);
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Variation + Date */
.tm-col-variation,
.tm-col-date {
    color: var(--gray-500);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Actions */
.tm-col-actions {
    text-align: right;
    white-space: nowrap;
}

.tm-btn-view {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--accent);
    color: white;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.tm-btn-view:hover {
    background: var(--accent-dark);
    color: white;
}

.tm-btn-view:visited {
    color: white;
}

.tm-btn-disabled {
    background: var(--gray-300);
    color: var(--gray-600);
    cursor: not-allowed;
}

.tm-btn-disabled:hover {
    background: var(--gray-300);
}

/* Empty / No Results */
.tm-empty {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--gray-500);
}

.tm-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tm-empty h3 {
    font-size: 1.2rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.tm-empty a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.tm-no-results {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-size: 0.95rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    margin-top: 1rem;
}


/* ----------------------------------------------------------------------------
   16. LANDING PAGE (index.php)
   ---------------------------------------------------------------------------- */

body.page-landing {
    height: auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

html:has(body.page-landing) {
    height: auto;
    overflow: auto;
}

/* Hero */
.landing-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 100%);
    color: white;
    padding: 3.25rem 2rem;
    text-align: center;
}

.landing-hero-inner {
    max-width: 700px;
    margin: 0 auto;
}

.landing-hero h2 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.landing-hero p {
    font-size: 1.1rem;
    opacity: 0.85;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.landing-hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.landing-btn--primary {
    background: #3B82F6;
    color: white;
}

.landing-btn--primary:hover {
    background: #2563EB;
    color: white;
}

.landing-btn--secondary {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.landing-btn--secondary:hover {
    background: rgba(255,255,255,0.25);
    color: white;
}

/* Feature Cards */
.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    padding: 3rem 2rem 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.landing-feature-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 1.75rem;
    text-align: center;
    transition: box-shadow 0.2s;
}

.landing-feature-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.landing-feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.landing-feature-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.landing-feature-card p {
    font-size: 0.85rem;
    color: var(--gray-500);
    line-height: 1.6;
}

/* Demo Access (Try It Yourself) */
.landing-demo-access {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 1.75rem 2rem;
    max-width: calc(1200px - 4rem);
    width: 100%;
    margin: 0 auto 1.5rem;
    text-align: center;
}
.landing-demo-access h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
}
.landing-demo-access p {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.landing-demo-access code {
    display: inline-block;
    font-size: 0.85rem;
}
.landing-demo-access a:not(.landing-btn) {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.landing-demo-access a:not(.landing-btn):hover {
    text-decoration: underline;
}

/* CTA */
.landing-cta {
    text-align: center;
    padding: 1rem;
    font-size: 0.95rem;
    color: var(--gray-600);
}

.landing-cta a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.landing-cta a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .landing-btn--desktop-only {
        display: none;
    }
}

/* Footer */
.landing-footer {
    margin-top: auto;
    text-align: center;
    padding: 1.25rem;
    font-size: 0.78rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
    background: white;
}

/* ----------------------------------------------------------------------------
   17. PUBLISHED TEMPLATES PAGE (published_templates.php)
   ---------------------------------------------------------------------------- */

body.page-published-templates {
    height: auto;
    overflow: auto;
}

html:has(body.page-published-templates) {
    height: auto;
    overflow: auto;
}

.tm-layout {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Toolbar */
.tm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.tm-toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.tm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tm-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.tm-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tm-stat {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.tm-stat-divider {
    color: var(--gray-300);
    font-size: 0.85rem;
}

.tm-toggle-all {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    color: var(--gray-600);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tm-toggle-all:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tm-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tm-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    pointer-events: none;
}

.tm-search {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    width: 260px;
    font-family: var(--font-sans);
    color: var(--gray-700);
    outline: none;
    transition: border-color 0.2s;
    background: white;
}

.tm-search:focus {
    border-color: var(--accent);
}

.tm-search-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    display: none;
    line-height: 1;
    transition: all 0.2s;
}

.tm-search-clear:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

/* Customer Group */
.tm-customer-group {
    margin-bottom: 0.75rem;
}

/* Customer Header — clickable */
.tm-customer-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    user-select: none;
    background: #eee;
    border: 1px solid #ccc;
}

.tm-customer-header:hover {
    background: var(--gray-100);
}

.tm-chevron {
    font-size: 0.65rem;
    color: var(--gray-400);
    transition: color 0.2s, transform 0.2s;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.tm-customer-group.tm-expanded .tm-chevron {
    color: var(--accent);
}

.tm-custid-badge {
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.85rem;
    border-radius: 20px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}

.tm-portal-count {
    font-size: 0.82rem;
    color: var(--gray-500);
}

/* Collapsible table wrapper */
.tm-table-wrapper {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    display: none;
    margin-top: 0.25rem;
}

.tm-customer-group.tm-expanded .tm-table-wrapper {
    display: block;
}

/* Table */
.tm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tm-table thead tr {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.tm-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.tm-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

.tm-table tbody tr:last-child {
    border-bottom: none;
}

.tm-table tbody tr:hover {
    background: var(--gray-50);
}

.tm-table td {
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    vertical-align: middle;
}

.tm-portal-name {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

.tm-type-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: #eff6ff;
    color: var(--accent);
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.tm-variation {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.tm-date {
    color: var(--gray-500);
    font-size: 0.85rem;
    white-space: nowrap;
}

.tm-published-by {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-style: italic;
}

.tm-published-by-cell {
    font-size: 0.82rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.tm-actions {
    text-align: right;
    white-space: nowrap;
}

.tm-user-filter-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tm-user-filter {
    padding: 0.5rem 2rem 0.5rem 0.85rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    color: var(--gray-700);
    background: white;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    cursor: pointer;
}

.tm-user-filter:focus {
    border-color: var(--accent);
}

.tm-user-filter-wrapper::after {
    content: '▾';
    position: absolute;
    right: 0.65rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    pointer-events: none;
}

.tm-btn-view {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--accent);
    color: white;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.tm-btn-view:hover {
    background: var(--accent-dark);
    color: white;
}

.tm-btn-view:visited {
    color: white;
}

.tm-btn-disabled {
    background: var(--gray-300);
    color: var(--gray-600);
    cursor: not-allowed;
}

.tm-btn-disabled:hover {
    background: var(--gray-300);
}

/* Empty / No Results */
.tm-empty {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--gray-500);
}

.tm-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tm-empty h3 {
    font-size: 1.2rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.tm-empty a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.tm-no-results {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-size: 0.95rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

/* ----------------------------------------------------------------------------
   18. REFERENCE GUIDE PAGE (reference_guide.php)
   ---------------------------------------------------------------------------- */

body.page-reference {
    height: auto;
    overflow: auto;
}

html:has(body.page-reference) {
    height: auto;
    overflow: auto;
}

.rg-page {
    max-width: 900px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.rg-page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rg-page-header h1 { font-size: 1.3rem; font-weight: 700; }

.rg-page-header p { font-size: 0.8rem; opacity: 0.85; margin-top: 0.2rem; }

.rg-page-header .version {
    background: rgba(255,255,255,0.2);
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Grid layout */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.cell {
    padding: 1.25rem 1.5rem;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.cell:last-child { border-right: none; }

.cell.full { grid-column: 1 / -1; border-right: none; }

.cell-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cell-title-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
}

/* Workflow steps */
.workflow { display: flex; flex-direction: column; gap: 0.5rem; }

.workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.step-num {
    background: #3B82F6;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.step-text { font-size: 0.85rem; color: #374151; line-height: 1.4; }

.step-text strong { color: #0A0E27; }

.step-sub { font-size: 0.75rem; color: #6b7280; margin-top: 0.15rem; }

/* Template types */
.template-list { display: flex; flex-direction: column; gap: 0.4rem; }

.template-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #374151;
}

.template-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-blue   { background: #3B82F6; }
.dot-green  { background: #10b981; }
.dot-purple { background: #8b5cf6; }
.dot-orange { background: #f59e0b; }

.template-var {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-left: auto;
}

/* Image requirements */
.img-req { display: flex; flex-direction: column; gap: 0.35rem; }

.img-req-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.img-req-label { font-weight: 600; color: #0A0E27; min-width: 80px; }

.img-req-val { color: #6b7280; }

/* Tips & Guidelines list */
.tips-list { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.tips-list li {
    font-size: 0.8rem;
    color: #374151;
    display: flex;
    gap: 0.4rem;
    line-height: 1.4;
}
.tips-list li:before { content: "💡"; flex-shrink: 0; }

/* Good to Know list */
.info-list { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.info-list li {
    font-size: 0.8rem;
    color: #374151;
    display: flex;
    gap: 0.4rem;
    line-height: 1.4;
}
.info-list li:before { content: "ℹ️"; flex-shrink: 0; }

/* Upcoming features */
.upcoming-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.upcoming-list {
    list-style: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.upcoming-list li {
    font-size: 0.82rem;
    color: #374151;
    display: flex;
    gap: 0.4rem;
    line-height: 1.4;
}

/* .upcoming-list li:before { content: "⏭️"; flex-shrink: 0; } */
.upcoming-list li:before { content: "🚀"; flex-shrink: 0; }


/* Known limitations Currently Not Used */
.limit-list { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.limit-list li {
    font-size: 0.8rem;
    color: #374151;
    display: flex;
    gap: 0.4rem;
    line-height: 1.4;
}
.limit-list li:before { content: "⚠️"; flex-shrink: 0; }

/* Feedback */
.feedback-ol {
    margin: 0 0 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.feedback-ol li {
    font-size: 0.82rem;
    color: #374151;
    line-height: 1.5;
}

.feedback-ol li strong { color: #0A0E27; }

/* Severity */
.severity-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.severity-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
}

.severity-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.sev {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sev-blocker { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.sev-major   { background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.sev-minor   { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.sev-suggest { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

@media print {
    body { background: white; padding: 0; }
    .rg-page { box-shadow: none; border-radius: 0; }
}

@media (max-width: 768px) {
    .rg-page {
		margin: .75rem 0.95rem;
		border-radius: 12px;
		box-shadow: none;
	}

    .rg-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1.25rem 1rem;
    }

    .rg-page-header h1 {
        font-size: 1rem;
    }

	.rg-page-header h3 {
        font-size: 1rem;
    }
	
    .rg-page-header .version {
        display: none;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .cell {
        border-right: none;
        padding: 1rem;
    }

    .cell.full {
        border-right: none;
    }

    .template-item {
        flex-wrap: wrap;
    }

    .template-var {
        margin-left: 1.3rem;
        font-size: 0.72rem;
    }

    .img-req-row {
        flex-direction: column;
        gap: 0.1rem;
    }

    .img-req-label {
        min-width: unset;
    }

    .upcoming-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .severity-grid {
        grid-template-columns: 1fr;
    }

    .feedback-ol {
        margin-left: 1rem;
    }
}

/* ----------------------------------------------------------------------------
   19. LOGIN PAGE (login.php)
   ---------------------------------------------------------------------------- */

body.page-login {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: auto;
}

html:has(body.page-login) {
    height: auto;
    overflow: auto;
}

/* Login wrapper */
.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.login-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.login-card p {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 2rem;
}

/* Login button */
.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-login:hover {
    background: var(--primary-light);
}


/* ----------------------------------------------------------------------------
   20. PUBLISH SUCCESS PAGE (publish_success.php)
   ---------------------------------------------------------------------------- */
body.page-publish-success {
    height: auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--gray-100);
}
html:has(body.page-publish-success) {
    height: auto;
    overflow: auto;
}

.ps-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.ps-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 2.5rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.ps-icon {
    font-size: 2.75rem;
    margin-bottom: 1rem;
}

.ps-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.ps-card > p {
    font-size: 0.95rem;
    color: var(--gray-500);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.ps-meta {
    background: var(--gray-100);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    text-align: left;
}

.ps-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}

.ps-meta-row + .ps-meta-row {
    border-top: 1px solid var(--gray-200);
}

.ps-meta-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ps-meta-value {
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 600;
}

.ps-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ps-actions .landing-btn {
    width: 100%;
}

/* Reuse landing-btn colors but adapt for light background instead of dark hero */
.ps-actions .landing-btn--secondary {
    background: var(--gray-100);
    color: var(--primary);
    border: 1px solid var(--gray-200);
}
.ps-actions .landing-btn--secondary:hover {
    background: var(--gray-200);
    color: var(--primary);
}

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