/**
 * CIB Pop Write - Corporate Design Styling
 * Professional CIB branding with clean, modern interface
 */

/* CIB Corporate Design Variables */
:root {
    /* CIB Primary Colors */
    --cib-red: #e11e19;
    --cib-black: #4D6278;
    
    /* CIB Gray Palette */
    --cib-gray-1: #4D6278;
    --cib-gray-2: #98A9B7;
    --cib-gray-3: #CCD7E4;
    --cib-gray-4: #DFE7F0;
    --cib-gray-5: #E9F0F7;
    --cib-gray-6: #F0F4F7;
    --cib-gray-7: #F6F9FB;
    
    /* CIB Neutral Colors */
    --cib-white: #ffffff;
    
    /* CIB Gradients */
    --cib-primary-gradient: linear-gradient(135deg, var(--cib-red) 0%, var(--cib-black) 100%);
    --cib-light-gradient: linear-gradient(135deg, var(--cib-gray-7) 0%, var(--cib-white) 100%);
    --cib-accent-gradient: linear-gradient(135deg, var(--cib-red) 0%, var(--cib-gray-1) 100%);
    
    /* Corporate Styling */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-bg-dark: rgba(77, 98, 120, 0.05);
    --glass-border: rgba(77, 98, 120, 0.1);
    --text-primary: var(--cib-black);
    --text-secondary: var(--cib-gray-2);
    --text-white: var(--cib-white);
    --shadow-primary: 0 4px 20px rgba(77, 98, 120, 0.1);
    --shadow-hover: 0 8px 30px rgba(77, 98, 120, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--cib-gray-7);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* CIB Corporate Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cib-light-gradient);
    z-index: -1;
}

/* Subtle brand accent pattern */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 20%, rgba(0, 61, 107, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(74, 144, 226, 0.05) 0%, transparent 50%);
    z-index: -1;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header Styling - CIB Corporate */
header {
    background: var(--cib-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-primary);
    transition: var(--transition);
    position: relative;
}

/* CIB brand accent line */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cib-primary-gradient);
}

header:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.header-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(77, 98, 120, 0.1));
}

header h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 600;
    color: var(--cib-red);
    text-shadow: none;
    margin-bottom: 0.5rem;
}

.header-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Main Content */
main {
    padding: 0;
}

/* Workflow Grid */
.workflow-grid {
    display: grid;
    grid-template-columns: 1fr 120px 1fr;
    grid-template-rows: 1fr 80px 120px 1fr;
    gap: 20px;
    margin-bottom: 3rem;
    position: relative;
    min-height: 700px;
}

/* Text Area Containers - CIB Corporate Style */
.text-area-container {
    background: var(--cib-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.text-area-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--cib-accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.text-area-container:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.text-area-container:hover::before {
    opacity: 1;
}

/* Grid Positioning */
.top-left {
    grid-column: 1;
    grid-row: 1;
}

.top-right {
    grid-column: 3;
    grid-row: 1;
}

.bottom-left {
    grid-column: 1;
    grid-row: 4;
}

.bottom-right {
    grid-column: 3;
    grid-row: 4;
}

/* Labels - CIB Corporate */
.text-area-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--cib-black);
    text-shadow: none;
}

/* Text Areas - CIB Corporate */
textarea {
    width: 100%;
    height: 200px;
    background: var(--cib-light-gray);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--cib-red);
    background: var(--cib-white);
    box-shadow: 0 0 0 3px rgba(225, 30, 25, 0.1);
}

textarea.focused {
    transform: scale(1.01);
}

textarea.processing {
    background: var(--cib-gray-7);
    border-color: var(--cib-red);
    animation: processing 1s ease-in-out;
}

@keyframes processing {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

textarea::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

/* Arrow Containers */
.arrow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

/* Arrow Positioning */
.arrow-down-left {
    grid-column: 1;
    grid-row: 2;
    align-items: center;
}

.arrow-horizontal-right {
    grid-column: 2;
    grid-row: 3;
    align-items: center;
    justify-content: center;
    position: relative;
    top: -30px;
}

.arrow-horizontal-left {
    grid-column: 2;
    grid-row: 3;
    align-items: center;
    justify-content: center;
    position: relative;
    top: 30px;
    transform: rotate(180deg);
}

.arrow-up-right {
    grid-column: 3;
    grid-row: 3;
    align-items: center;
}

/* Arrow Styles */
.arrow {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrow-body {
    width: 60px;
    height: 4px;
    background: var(--cib-accent-gradient);
    border-radius: 2px;
    position: relative;
    box-shadow: 0 2px 8px rgba(225, 30, 25, 0.2);
}

.arrow-vertical .arrow-body {
    width: 4px;
    height: 60px;
}

.arrow-horizontal .arrow-body {
    width: 60px;
    height: 4px;
}

.arrow-head {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid var(--cib-red);
    position: absolute;
    right: -8px;
    filter: drop-shadow(0 2px 4px rgba(225, 30, 25, 0.2));
}

.arrow-vertical .arrow-head {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--cib-red);
    border-bottom: none;
    bottom: -8px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

.arrow-horizontal .arrow-head {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid var(--cib-red);
    position: absolute;
    right: -8px;
    border-top: none;
    filter: drop-shadow(0 2px 4px rgba(225, 30, 25, 0.2));
}

.arrow-horizontal-reverse .arrow-body {
    width: 60px;
    height: 4px;
}

.arrow-horizontal-reverse .arrow-head {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid var(--cib-red);
    position: absolute;
    left: -8px;
    border-top: none;
    transform: rotate(180deg);
    filter: drop-shadow(0 2px 4px rgba(225, 30, 25, 0.2));
}

.arrow-vertical-up .arrow-body {
    width: 4px;
    height: 60px;
}

.arrow-vertical-up .arrow-head {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid var(--cib-red);
    border-top: none;
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 2px 4px rgba(225, 30, 25, 0.2));
}

/* Arrow Labels - CIB Corporate */
.arrow-label {
    background: var(--cib-white);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cib-black);
    box-shadow: 0 2px 12px rgba(77, 98, 120, 0.1);
    min-width: 120px;
}

.arrow-horizontal-right .arrow-label {
    margin-top: 1rem;
}

.arrow-horizontal-left .arrow-label {
    margin-top: 1rem;
    transform: rotate(180deg);
}

.arrow-label img.logo-small {
    width: 24px;
    height: 24px;
    margin-bottom: 0.25rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 4px;
}

/* CIB logo placeholder for arrows */
.arrow-label img.logo-small {
    background: var(--cib-primary-gradient);
    content: '';
}

.arrow-label small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Prompt Section - CIB Corporate */
.prompt-section {
    background: var(--cib-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-primary);
    transition: var(--transition);
}

.prompt-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.prompt-section h3 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
    color: var(--cib-red);
}

.prompt-display {
    background: var(--cib-gray-7);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1.5rem;
    font-family: 'Segoe UI', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.prompt-note {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer - CIB Corporate */
footer {
    background: var(--cib-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: var(--shadow-primary);
    margin-top: 2rem;
    position: relative;
}

/* CIB brand accent line for footer */
footer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--cib-primary-gradient);
}

footer p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .workflow-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto auto auto auto;
        gap: 15px;
        min-height: auto;
    }
    
    .top-left {
        grid-column: 1;
        grid-row: 1;
    }
    
    .arrow-down-left {
        grid-column: 1;
        grid-row: 2;
        transform: rotate(90deg);
    }
    
    .bottom-left {
        grid-column: 1;
        grid-row: 3;
    }
    
    .arrow-horizontal-right {
        grid-column: 1;
        grid-row: 4;
        transform: rotate(90deg);
        position: relative;
        top: 0;
    }
    
    .bottom-right {
        grid-column: 1;
        grid-row: 5;
    }
    
    .arrow-horizontal-left {
        grid-column: 1;
        grid-row: 6;
        transform: rotate(90deg);
        position: relative;
        top: 0;
    }
    
    .top-right {
        grid-column: 1;
        grid-row: 7;
    }
    
    .arrow-up-right {
        grid-column: 1;
        grid-row: 8;
        transform: rotate(90deg);
    }
    
    .arrow-label {
        min-width: 100px;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .arrow-horizontal-right .arrow-label {
        transform: none;
        margin-top: 1rem;
    }
    
    .arrow-horizontal-left .arrow-label {
        transform: none;
        margin-top: 1rem;
    }
    
    textarea {
        height: 150px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .text-area-container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .prompt-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .text-area-container {
        padding: 0.8rem;
    }
    
    .prompt-section {
        padding: 1rem;
    }
    
    .arrow-body {
        width: 40px;
        height: 3px;
    }
    
    .arrow-vertical .arrow-body {
        width: 3px;
        height: 40px;
    }
    
    .arrow-head {
        border-left-width: 6px;
        border-right-width: 6px;
        border-bottom-width: 10px;
    }
    
    .arrow-vertical .arrow-head {
        border-left-width: 6px;
        border-right-width: 6px;
        border-top-width: 10px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --glass-bg: var(--cib-white);
        --glass-border: var(--cib-medium-gray);
    }
    
    textarea {
        background: var(--cib-white);
        border: 2px solid var(--cib-medium-gray);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::after {
        display: none;
    }
}