@import "../../theme.css";

*, *::before, *::after { box-sizing: border-box; }
input, textarea, button { font-family: inherit; }

body { 
    margin: 0; padding: 16px; background-color: var(--bg-main); 
    -webkit-font-smoothing: antialiased; color: var(--text-primary); 
    height: 100vh; height: 100dvh; overflow: hidden; letter-spacing: -0.01em; 
    width: 100%; max-width: 100%; overflow-x: hidden;
}

*:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
input:focus, textarea:focus, button:focus { outline: none !important; }

.tool-wrapper { display: flex; flex-direction: column; height: 100%; gap: 12px; animation: fadeIn 0.3s ease; width: 100%; max-width: 100%; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

.tool-header { display: flex; justify-content: space-between; align-items: center; }
.header-main h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px 0; display: flex; align-items: center; gap: 8px;}
.header-main p { margin: 0; font-size: 12px; color: var(--text-secondary); }

.workspace-grid { flex: 1; display: grid; grid-template-columns: 360px 1fr; gap: 14px; min-height: 0; width: 100%; }

.pane { 
    background-color: var(--bg-card) !important; border: 1px solid var(--border-color); 
    border-radius: 12px; padding: 16px; display: flex; flex-direction: column; 
    gap: 12px; position: relative; min-height: 0; width: 100%; box-sizing: border-box;
}
.pane:focus-within { border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-tint); }

.pane-header { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 4px; }
.pane-title { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; }

.badge { font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 4px; letter-spacing: 0.05em; }
.badge-slate { background-color: var(--bg-active); color: var(--text-secondary); }
.badge-indigo { background-color: var(--accent-tint); color: var(--accent-color); }

.config-form { display: flex; flex-direction: column; gap: 16px; flex: 1; width: 100%; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.custom-input { background-color: #F8FAFC; border: 1px solid var(--border-color); border-radius: 6px; padding: 0 12px; font-size: 13px; color: var(--text-primary); height: 42px; transition: all var(--transition-smooth); width: 100%; box-sizing: border-box; }
.custom-input:focus { background-color: #FFF; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-tint); }

.custom-textarea { background-color: #F8FAFC; border: 1px solid var(--border-color); border-radius: 6px; padding: 12px; font-size: 13px; color: var(--text-primary); transition: all var(--transition-smooth); width: 100%; box-sizing: border-box; flex: 1; resize: none; line-height: 1.6; }
.custom-textarea:focus { background-color: #FFF; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-tint); }
.custom-textarea::-webkit-scrollbar { width: 6px; }
.custom-textarea::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.1); border-radius: 3px; }

.btn { box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; font-weight: 500; transition: all var(--transition-smooth); background-color: #FFF; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; font-family: inherit !important; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 11px; }
.btn-muted { border-color: var(--border-color); color: var(--text-secondary); }
.btn-muted:hover { background-color: var(--bg-active-hover); color: var(--text-primary); }
.btn-primary { background-color: var(--accent-color); color: #FFF; border-color: var(--accent-color); }
.btn-primary:hover { opacity: 0.95; box-shadow: 0 2px 6px rgba(79, 70, 229, 0.15); }
.btn:active { transform: scale(0.97); }

.btn-generate-action { width: 100%; height: 46px; font-size: 14px; font-weight: 600; border-radius: 8px; margin-top: auto; flex-shrink: 0; }
.btn-generate-action:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.preview-pane { padding: 0; overflow: hidden; background-color: #F8FAFC; border: 2px dashed transparent; position: relative; width: 100%; }
.message-board { display: flex; flex-direction: column; gap: 16px; padding: 56px 16px 20px 16px; overflow-y: auto; height: 100%; width: 100%; box-sizing: border-box; scroll-behavior: smooth; }
.message-board::-webkit-scrollbar { width: 6px; }
.message-board::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.1); border-radius: 3px; }

.msg-card { background: #FFF; border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02); display: flex; flex-direction: column; gap: 10px; transition: transform 0.2s; animation: slideUp 0.3s ease; }
.msg-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04); border-color: rgba(79, 70, 229, 0.2); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.msg-header { display: flex; justify-content: space-between; align-items: flex-end; }
.msg-author { font-size: 13px; font-weight: 700; color: var(--accent-color); display: flex; align-items: center; gap: 6px; }
.msg-author::before { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; background-color: var(--accent-color); }
.msg-time { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; }
.msg-content { font-size: 13.5px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; word-break: break-all; }

.empty-state { flex-direction: column; justify-content: center; align-items: center; text-align: center; height: 100%; color: var(--text-secondary); font-size: 13px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border-color); border-top-color: var(--accent-color); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-notification { 
    position: fixed; top: -50px; left: 50%; transform: translateX(-50%); 
    background-color: rgba(15, 23, 42, 0.95); color: #FFF; padding: 10px 20px; 
    border-radius: 8px; font-size: 13px; font-weight: 500; 
    box-shadow: 0 6px 20px rgba(0,0,0,0.15); z-index: 9999; display: flex; 
    align-items: center; gap: 8px; opacity: 0; transition: top 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease; 
    pointer-events: none; max-width: 85vw; white-space: normal; word-break: break-all; line-height: 1.5;
}
.toast-notification.show { top: 20px; opacity: 1; }

@media (max-width: 850px) {
    body { padding: 8px; overflow-y: auto; height: auto; overflow-x: hidden; }
    input, textarea { font-size: 16px !important; }
    
    .tool-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .header-main h2 { font-size: 15px; }

    .workspace-grid { grid-template-columns: 1fr; height: auto; gap: 10px; display: flex; flex-direction: column; } 
    
    .config-pane { min-height: 380px; padding: 16px; border-radius: 12px; }
    .preview-pane { min-height: 500px; height: 65vh; border-radius: 12px; }
    .btn-generate-action { margin-top: 10px; }
}