/* Progress Bar */
.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    border-bottom: 1px solid var(--bg-tertiary);
    z-index: 1001;
    padding: 1rem 2rem 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 33%;
    border-radius: 2px;
    transition: width var(--transition-slow);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.step-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.progress-step.active .step-circle {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-light);
    box-shadow: var(--shadow-blue);
}

.progress-step span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-step.active span {
    color: var(--primary-color);
}

/* Modern Navigation */
.modern-navbar {
    position: static;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    transition: all var(--transition-normal);
}

.brand-link:hover {
    color: white;
    transform: translateX(-2px);
    text-decoration: none;
}

.brand-icon {
    font-size: 1.8rem;
    color: white;
}

.brand-text {
    font-weight: 700;
    font-size: 1.3rem;
}

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

.btn-help,
.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.btn-help {
    background: var(--primary-lightest);
    color: var(--primary-color);
    border: 1px solid var(--primary-lighter);
}

.btn-help:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-back {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--bg-tertiary);
}

.btn-back:hover {
    background: var(--text-secondary);
    color: white;
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    min-height: 100vh;
    background: var(--bg-secondary);
}

.container-modern {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.header-content {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.header-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 1.8rem;
    box-shadow: var(--shadow-blue);
}

.form-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.form-header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.header-tips {
    display: flex;
    justify-content: center;
}

.tip-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--warning-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

/* Design Workspace */
.design-workspace {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

/* Canvas Section */
.canvas-section {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--bg-tertiary);
}

.canvas-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-lightest), white);
    border-bottom: 1px solid var(--primary-lighter);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.3rem;
}

.canvas-header i {
    color: var(--primary-color);
}

.canvas-controls {
    display: flex;
    gap: 0.5rem;
}

.canvas-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--primary-lighter);
    background: white;
    color: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.canvas-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.canvas-wrapper {
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 450px;
    background: var(--bg-secondary);
}

canvas {
    border: 2px solid var(--primary-lighter);
    background-color: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 100%;
    transition: all var(--transition-normal);
}

canvas:hover {
    box-shadow: var(--shadow-xl);
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.dimension-label {
    position: absolute;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: var(--shadow-md);
}

.dimension-width {
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
}

.dimension-height {
    top: 50%;
    left: 1rem;
    transform: translateY(-50%) rotate(-90deg);
}

.canvas-footer {
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
}

.canvas-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.canvas-info i {
    color: var(--primary-color);
}

/* Form Section */
.form-section {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.form-container {
    padding: 2rem;
}

.form-header-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.form-header-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.form-header-section i {
    color: var(--primary-color);
}

.form-header-section p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.form-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-label i {
    color: var(--primary-color);
}

.input-wrapper {
    position: relative;
}

.modern-input,
.modern-select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.modern-input:focus,
.modern-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-unit {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
}

.input-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Area Calculator */
.area-calculator {
    background: linear-gradient(135deg, var(--primary-lightest), var(--secondary-color)/10);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--primary-lighter);
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.calc-header i {
    color: var(--primary-color);
}

.calc-result {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* Important Note */
.important-note {
    background: linear-gradient(135deg, #fef3c7, #fef9e7);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.note-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #92400e;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.note-header i {
    color: #f59e0b;
    font-size: 1.1rem;
}

.important-note p {
    color: #78350f;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.important-note strong {
    font-weight: 700;
    color: #92400e;
}

/* Error Container */
.error-container {
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    color: var(--error-color);
    font-weight: 600;
    margin-bottom: 1rem;
    min-height: auto;
    transition: all var(--transition-normal);
}

.error-container:empty {
    display: none;
    padding: 0;
    margin: 0;
    border: none;
}

.error-container.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

/* Validation styles */
.validation-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #dc2626;
    font-weight: 600;
    animation: slideDown 0.3s ease-out;
}

.validation-error::before {
    content: '⚠ ';
}

.validation-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #10b981;
    font-weight: 600;
    animation: slideDown 0.3s ease-out;
}

.validation-success::before {
    content: '✓ ';
}

.modern-input.is-invalid {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.modern-input.is-invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

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

/* Form Actions */
.form-actions {
    margin-bottom: 2rem;
}

.btn-generate {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1.25rem 2rem;
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-blue);
    margin-bottom: 1rem;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgb(59 130 246 / 0.4);
}

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

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.btn-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.btn-generate.loading .btn-content {
    opacity: 0;
}

.btn-generate.loading .btn-loading {
    display: flex;
}

.btn-generate.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.preset-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-lightest);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.canvas-wrapper canvas {
    transition: transform var(--transition-normal);
}

/* Responsive Canvas */
@media (max-width: 1024px) {
    .design-workspace {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .canvas-section {
        order: 2;
    }
    
    .form-section {
        order: 1;
    }
    
    .canvas-wrapper {
        min-height: 350px;
    }
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-generate:hover .btn-shine {
    left: 100%;
}

.action-secondary {
    display: flex;
    gap: 1rem;
}

.btn-secondary {
    flex: 1;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--bg-tertiary);
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: white;
    transform: translateY(-1px);
}

/* Quick Presets */
.quick-presets {
    border-top: 1px solid var(--bg-tertiary);
    padding-top: 2rem;
}

.quick-presets h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

.quick-presets i {
    color: var(--warning-color);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.preset-btn {
    background: white;
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-lightest);
    transform: translateY(-2px);
}

.preset-size {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.preset-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    padding: 1rem;
    box-sizing: border-box;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-normal);
    margin: auto;
    position: relative;
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    margin: 0;
}

.modal-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.modal-close:hover {
    background: var(--error-color);
    color: white;
}

.modal-body {
    padding: 1rem 2rem 2rem;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h4 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

.help-section ol,
.help-section ul {
    padding-left: 1.5rem;
}

.help-section li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .design-workspace {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .canvas-section {
        order: 2;
    }
    
    .form-section {
        order: 1;
    }
}

@media (max-width: 768px) {
    .progress-bar-container {
        padding: 1rem 1rem 0.5rem;
    }
    
    .progress-steps {
        display: none;
    }
    

    
    .container-modern {
        padding: 1rem;
    }
    
    .form-header h1 {
        font-size: 2rem;
    }
    
    .nav-actions {
        gap: 0.5rem;
    }
    
    .btn-help span,
    .btn-back span {
        display: none;
    }
    
    .presets-grid {
        grid-template-columns: 1fr;
    }
    
    .action-secondary {
        flex-direction: column;
    }
    
    .canvas-wrapper {
        padding: 1rem;
        min-height: 300px;
    }
    
    .dimension-label {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 0.5rem;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
        width: 95%;
    }
    
    .brand-text {
        font-size: 1.1rem;
    }
    
    .form-header h1 {
        font-size: 1.8rem;
    }
    
    .form-header p {
        font-size: 1rem;
    }
    
    .tip-card {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
    
    .canvas-header {
        padding: 1rem;
    }
    
    .canvas-header h3 {
        font-size: 1.1rem;
    }
    
    .form-container {
        padding: 1.5rem;
    }
}

/* Enhanced validation styles */
.modern-input.valid {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.modern-input.invalid {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.modern-input.valid:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.modern-input.invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Pulse animation for generate button when ready */
.btn-generate.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Enhanced preset button interactions */
.preset-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.preset-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.preset-btn.active .preset-size {
    color: white;
    font-weight: 600;
}

.preset-btn.active .preset-desc {
    color: rgba(255, 255, 255, 0.9);
}

/* Canvas controls enhancements */
.canvas-btn {
    transition: all 0.3s ease;
}

.canvas-btn:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    color: white;
}

/* Tooltip styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    animation: fadeInTooltip 0.3s ease forwards;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}

@keyframes fadeInTooltip {
    to { opacity: 1; }
}

/* Loading animation improvements */
.btn-generate.loading .btn-content {
    opacity: 0;
}

.btn-generate.loading .btn-loading {
    opacity: 1;
}

.btn-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}