/* styles.css - CLEANED VERSION */
/* 1. CSS Variables */
:root {
    /* Colors */
    --primary-color: #333;
    --secondary-color: #666;
    --header-blue: #1e3c72;
    --header-blue-gradient: linear-gradient(135deg, #1e3c72, #2a5298);
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --background-color: #f5f5f5;
    --border-color: #ddd;
    --hover-border: #80bdff;
    --hover-background: #e9ecef;
    --info-bg: #f8f9fa;
    
    /* Layout Dimensions */
    --overlay-top-height: 155px;
    --overlay-bottom-height: 120px;
    --esignage-header: 190px;
    --esignage-footer: 160px;
    --lectern-top: 480px;
    --stagecube-top: 500px;
    --projection-top: 200px;
    --projection-bottom: 150px;
    --spacing-base: 1rem;
    
    /* Canvas Dimensions */
    --canvas-width-horizontal: 900px;
    --canvas-height-horizontal: 506px;
    --canvas-width-vertical: 506px;
    --canvas-height-vertical: 900px;
    
    /* Typography */
    --font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    --header-size: clamp(20px, 2vw, 22px);
    --h1-size: clamp(1.25em, 3vw, 1.5em);
    --h2-size: clamp(1.1em, 2.5vw, 1.3em);
    
    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --transition-speed: 0.3s;
}

/* 2. Base/Global Styles */
body {
    font-family: var(--font-family);
    margin: 0;
    color: var(--primary-color);
    line-height: 1.6;
    background-color: var(--background-color);
}

h1 {
    margin: 0;
    font-weight: 700;
    font-size: var(--h1-size);
}

h2 {
    margin-bottom: 1em;
    font-weight: 700;
    font-size: var(--h2-size);
    color: var(--primary-color);
}

/* 3. Header Styling */
.custom-header {
    position: relative;
    background: var(--header-blue-gradient);
    color: white;
    padding: 1.5rem 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23ffffff" fill-opacity="0.2"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

.header-content {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    gap: 2rem;
}

.logo-container {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-height: 50px; /* Maintain the original height of the container */
}

.logo {
    max-height: 25px !important; /* Half of the original 50px */
    width: auto; /* Maintain aspect ratio */
    object-fit: contain; /* Preserve aspect ratio */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    margin: 0; /* Ensure no additional spacing is added */
}

.title-container {
    flex: 0 0 auto;
    text-align: center;
}

.title-container h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
}

/* 4. How to Use Section */
.instruction-panel {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.instruction-panel h2 {
    font-size: 1.6rem;
    color: var(--header-blue);
    font-weight: 600;
}

.step-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 15px;
}

.step {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    flex: 1 1 200px;
    margin: 5px;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: var(--header-blue);
    color: white;
    border-radius: 50%;
    margin-right: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.step-text {
    font-size: 15px;
    color: #333;
}

/* 5. Canvas and Preview */
#canvas-container {
    background-color: transparent;
    box-shadow: none;
    display: block;
    margin: 1rem auto 0.5rem auto !important;
    max-width: 100%;
    text-align: center;
}

#preview-canvas {
    width: var(--canvas-width-horizontal);
    height: var(--canvas-height-horizontal);
    border-radius: 4px;
    border: none;
    box-shadow: none;
    object-fit: contain;
    background: transparent;
}

/* 6. Template-specific Styles */
.template-lectern #canvas-container,
.template-stageCube #canvas-container {
    margin-bottom: 0.5rem;
    max-width: var(--canvas-width-vertical);
    width: var(--canvas-width-vertical);
    height: var(--canvas-height-vertical);
}

.template-lectern #preview-canvas,
.template-stageCube #preview-canvas {
    width: 415px;
    height: 738px;
    margin: 0 auto;
}

.template-chair #canvas-container,
.template-esignage #canvas-container,
.template-sessionPresentation #canvas-container,
.template-projection #canvas-container {
    margin-bottom: 2rem;
}

/* 7. Template Info Containers */
.template-info-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 2rem;
    margin-top: 0;
}

.template-header {
    padding: 1.5rem 1.7rem !important; /* Slightly more horizontal padding */
    color: white !important;
    background: linear-gradient(135deg, #1e3c72, #2a5298) !important; /* Consistent blue gradient */
}

.template-content {
    background-color: #f8f9fa;
    padding: 1rem 1.2rem !important; /* Increase padding around content */
    line-height: 1.6 !important;
}

.template-info-container .template-content h4 {
    width: 307px !important; /* Your requested width */
    height: 28.8px !important; /* Your requested height */
    margin-top: 1.1rem !important; /* Slightly more space above headings */
    margin-bottom: 0.4rem !important; /* Slightly more space below headings */
    font-weight: 700 !important; /* Bolder font weight */
    font-size: 1.25rem !important; /* Slightly larger font size */
    line-height: 28.8px !important; 
    letter-spacing: 0.01em !important; /* Better letter spacing */
    display: block !important;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
    color: #333 !important; /* Ensure consistent color */
}

.template-info-container .template-content p {
    margin-bottom: 0.7rem !important; /* More space between paragraphs */
    line-height: 1.6 !important;
    font-size: 1rem !important; /* Ensure consistent font size */
}

.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem !important; /* Increase spacing in grid */
    margin: 1.2rem 0 1.5rem 0 !important; /* Better vertical spacing */
}

.specs-grid div {
    line-height: 1.6 !important;
}

/* 8. Form Elements */
.drop-zone {
    background-color: #fff;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.drop-zone.dragover {
    background-color: var(--hover-background);
    border-color: var(--hover-border);
    transform: scale(1.01);
}

#name-color-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #f8f9fa;
}

#name-color-container.d-none {
    display: none !important;
}

/* 9. Color Picker */
.color-picker {
    width: 50px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#name-color-container label {
    height: 24px;
    margin-bottom: 8px;
    display: block;
}

#name-input-help {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 10. Language Selector */
.language-selector {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

#language-toggle {
    font-weight: 600;
    min-width: 45px;
    padding: 3px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#language-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 11. Responsive Styles */
@media (max-width: 768px) {
    /* Header */
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo-container {
        margin-bottom: 0;
    }
    
    .language-selector {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-top: 10px;
    }
    
    /* Specs Grid */
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    /* Step container */
    .step {
        flex: 1 1 100%;
        width: 90px;
        margin: 0 8px 15px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Canvas spacing */
    #canvas-container {
        margin-bottom: 2.5rem;
    }
    
    #instructions, 
    #details {
        margin-top: 1.5rem;
    }
    
    /* Name/color container */
    #name-color-container {
        grid-template-columns: 1fr;
    }
    
    /* How To Use Section */
    .step-container {
        justify-content: flex-start;
        padding-left: 15px;
    }
    
    .step-number {
        margin: 0;
    }
    
    .step-text {
        text-align: left;
        margin-top: 8px;
        font-size: 0.8rem;
        padding-left: 2px;
    }
    
    /* Canvas responsive size */
    #preview-canvas {
        max-width: 100%;
        height: auto;
        min-height: 300px;
    }
}

/* Template Container - Migrated from inline styles */
.template-container {
    display: flex;
    flex-direction: column;
    gap: 1rem !important;
}

/* Template-specific adjustments - Migrated from inline styles */
.lectern-template #canvas-container,
.template-lectern #canvas-container {
    margin-bottom: 0.5rem !important;
    max-width: var(--canvas-width-vertical);
    width: var(--canvas-width-vertical);
    height: var(--canvas-height-vertical);
}

.lectern-template #preview-canvas,
.template-lectern #preview-canvas {
    width: 415px;
    height: 738px;
    margin: 0 auto;
}

/* ======================================= */
/* MIGRATED STYLES - PHASE 1 */
/* ======================================= */

/* 1. Template Container Layout */
.template-container {
    display: flex;
    flex-direction: column;
    gap: 1rem !important;
}

/* 2. Template-specific Spacing for Vertical Templates */
.template-lectern #canvas-container,
.template-stageCube #canvas-container {
    margin-bottom: 0.5rem !important;
    height: auto !important;
}

/* 3. Canvas Size Definitions for Vertical Templates */
body.template-lectern #preview-canvas,
body.template-stageCube #preview-canvas {
    width: 415px;
    height: 738px;
    margin: 0 auto 0.5rem !important;
}

/* 4. Compact Instructions for Vertical Templates */
.template-lectern #instructions,
.template-stageCube #instructions,
body.template-lectern #instructions,
body.template-stageCube #instructions {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

/* 5. Compact Details for Vertical Templates */
.template-lectern #details,
.template-stageCube #details,
body.template-lectern #details,
body.template-stageCube #details {
    margin-top: 0.5rem !important;
}

/* 6. Template Content Styling */
.template-content {
    padding: 0.75rem !important;
}

.template-info-container h4 {
    margin-top: 0.75rem !important;
    margin-bottom: 0.25rem !important;
}

.template-info-container p {
    margin-bottom: 0.5rem !important;
}

/* 7. Template Header Styling */
.template-header {
    padding: 0.75rem 1.5rem !important;
}

/* 8. Preview Section Spacing */
.preview-section {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* 9. Name Color Container Display Logic */
#name-color-container { 
    display: grid; 
}
#name-color-container:not(.d-none) { 
    display: grid; 
}
#name-color-container.d-none { 
    display: none !important; 
}

/* 10. Canvas Container Styling */
#canvas-container {
    margin: 1rem auto 0.5rem auto !important;
}

/* 11. Responsive Layout Overrides */
.template-lectern .form-group, 
.template-stageCube .form-group {
    margin-bottom: 0.5rem !important;
}

/* Toast container positioning - move from inline to CSS */
[aria-live="polite"][aria-atomic="true"] {
    position: fixed;
    top: 1rem;
    right: 1rem;
}

/* Template header colors */
.template-header.lectern,
.template-header.stageCube {
    background: var(--header-blue-gradient);
}

.template-header.chair {
    background: linear-gradient(135deg, #117a65, #27ae60);
}

.template-header.esignage {
    background: linear-gradient(135deg, #5b2c6f, #8e44ad);
}

.template-header.sessionPresentation {
    background: linear-gradient(135deg, #1a5276, #2980b9);
}

.template-header.projection {
    background: linear-gradient(135deg, #7d3c98, #a569bd);
}

/* ======================================= */
/* CRITICAL FIX FOR INSTRUCTION HEADERS - FROM COMPARISON FILES */
/* ======================================= */

/* Use consistent blue styling for ALL instruction headers */
#instructions.alert-info {
    background-color: #cce5ff !important; /* Bootstrap's alert-info color */
    color: #004085 !important; /* Bootstrap's alert-info text color */
    border-color: #b8daff !important;
}

/* REPLACE all template header styles with consistent styling */
.template-header {
    padding: 1.5rem !important;
    color: white !important;
    background: linear-gradient(135deg, #1e3c72, #2a5298) !important; /* Consistent blue gradient */
}

/* Add these styles to specifically style template info headers ONLY */
.template-info-container > div > .template-header.chair {
    background: linear-gradient(135deg, #117a65, #27ae60) !important;
}

.template-info-container > div > .template-header.esignage {
    background: linear-gradient(135deg, #5b2c6f, #8e44ad) !important;
}

.template-info-container > div > .template-header.sessionPresentation {
    background: linear-gradient(135deg, #1a5276, #2980b9) !important;
}

.template-info-container > div > .template-header.projection {
    background: linear-gradient(135deg, #7d3c98, #a569bd) !important;
}

/* Add specific styling for the h4 elements in Technical Specifications sections */
.template-info-container .template-content h4 {
    width: 307px !important;
    height: 28.8px !important;
    margin-top: 0.75rem !important;
    margin-bottom: 0.25rem !important;
    font-weight: 600;
    font-size: 1.2rem;
    line-height: 28.8px !important; 
    display: block !important;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box !important;
    color: #333 !important; /* Ensure consistent color */
}