/* Container Layout */
.hw-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    align-items: start;
}

/* Left Panel Controls */
.hw-controls { display: flex; flex-direction: column; gap: 20px; }

.hw-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.hw-label {
    display: block; font-weight: 700; color: var(--text-main); margin-bottom: 12px;
    font-size: 0.95rem; display: flex; align-items: center; gap: 6px;
}

/* Textarea */
.hw-textarea {
    width: 100%; height: 220px;
    background: var(--bg-body); border: 2px solid var(--border-color); border-radius: 12px;
    padding: 16px; font-family: 'Inter', sans-serif; color: var(--text-main);
    font-size: 0.95rem; resize: vertical; outline: none; transition: border-color 0.3s; line-height: 1.5;
}
.hw-textarea:focus { border-color: var(--primary-blue); }

/* Settings Grid */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.hw-setting-group { display: flex; flex-direction: column; }

.hw-select {
    width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-color);
    background: var(--bg-body); color: var(--text-main); font-weight: 600; outline: none; cursor: pointer;
}
.hw-select optgroup { font-weight: bold; color: var(--primary-blue); }
.hw-select option { color: var(--text-main); font-weight: normal; }

/* Color Picker UI */
.color-options { display: flex; gap: 12px; margin-top: 4px;}
.color-radio input[type="radio"] { display: none; }
.color-circle {
    display: inline-block; width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    border: 3px solid var(--bg-surface); box-shadow: 0 0 0 1px var(--border-color); transition: transform 0.2s, box-shadow 0.2s;
}
.color-radio input[type="radio"]:checked + .color-circle {
    transform: scale(1.15); box-shadow: 0 0 0 2px var(--primary-blue);
}

/* Slider */
.hw-slider { width: 100%; accent-color: var(--primary-blue); height: 6px; border-radius: 10px; outline: none; margin-top: 4px; }
.highlight-text { color: var(--primary-blue); font-weight: 800; }

/* Generate Button */
.hw-generate-btn { padding: 16px; font-size: 1.05rem; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, var(--primary-blue), #1d4ed8); color: white; border: none; border-radius: 50px; font-weight: 700; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); }
.hw-generate-btn:active { transform: scale(0.96); }

/* Right Panel Preview */
.hw-preview-section {
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-radius: 20px; padding: 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
}

.preview-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color);
}
.preview-title { font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 6px; }
.preview-badge { background: rgba(37, 99, 235, 0.1); color: var(--primary-blue); padding: 6px 14px; border-radius: 50px; font-size: 0.8rem; font-weight: 700; }

/* Canvas Scaler - Maintains A4 Ratio */
.canvas-wrapper {
    width: 100%; aspect-ratio: 1 / 1.414; background: #e2e8f0; border-radius: 8px;
    overflow: hidden; border: 1px solid var(--border-color); box-shadow: inset 0 0 10px rgba(0,0,0,0.1); display: flex; justify-content: center; align-items: center;
}

#page-canvas { width: 100%; height: 100%; object-fit: contain; display: block; background: white; }

/* Modal Styles */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; opacity: 1; transition: opacity 0.3s ease; }
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content { background: var(--bg-surface); width: 100%; max-width: 400px; border-radius: 24px; border: 1px solid var(--border-color); box-shadow: 0 20px 40px rgba(0,0,0,0.2); transform: translateY(0); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal-overlay.hidden .modal-content { transform: translateY(30px); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
.modal-body { padding: 24px; }
.info-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.info-list li { display: flex; align-items: flex-start; gap: 12px; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }
.info-list i { font-size: 20px; flex-shrink: 0; margin-top: 2px; }

/* Mobile */
@media (max-width: 900px) {
    .hw-container { grid-template-columns: 1fr; gap: 20px; }
    .settings-grid { grid-template-columns: 1fr; }
}
