/* style.css - App-level styles for Word Processor */

@import url('../../lib/swat-ui.css');

/* Base app layout */
:root{
  --sidebar-width: 340px; /* increased for longer filenames */
  --accent: #0b79ff;
  --muted: #6b7280;
  --surface: #ffffff;
  --panel-bg: #f7f9fb;
  --radius: 8px;
  --gap: 12px;
}

html,body,#root{height:100%;}
body{font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; background: linear-gradient(180deg,#f4f7fb,#ffffff); margin:0;}

.word-processor{
  display:flex;
  height:100vh;
  gap:var(--gap);
}

.editor-layout{
  display:flex;
  flex:1 1 auto;
  align-items:stretch;
}

/* Sidebar / Documents panel */
.documents-panel{
  width:var(--sidebar-width);
  background:var(--surface);
  border-right:1px solid rgba(15,23,42,0.04);
  padding:16px;
  box-shadow: 0 1px 4px rgba(16,24,40,0.04);
  overflow:auto;
}
.documents-panel h3{margin:0 0 12px 0;color:#111827;font-weight:600}
.documents-panel .btn{margin-right:8px}
.documents-panel #search{width:100%;padding:8px;border:1px solid #e6eef8;border-radius:6px}
.documents-panel ul{list-style:none;padding:0;margin-top:12px}
.documents-panel li{padding:8px 6px;border-radius:6px;display:flex;align-items:center;justify-content:space-between}
.documents-panel li:hover{background:var(--panel-bg)}
.documents-panel .doc-title{font-size:0.95rem;color:#111827}

/* Actions container (left) and filename container (right) */
.documents-panel .doc-actions{
    display:flex;
    gap:8px;
    flex:0 0 auto;
}
.documents-panel .doc-title-right{
    flex:1 1 auto;
    text-align:right;
    padding-left:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:0.95rem;
    color:#111827;
}

/* Delete button styling in documents panel */
.documents-panel button[data-action="delete"]{
  background:#ef4444; /* red-500 */
  color:#fff;
  border:none;
  box-shadow:none;
}
.documents-panel button[data-action="delete"]:hover{
  background:#dc2626; /* red-600 */
}
.documents-panel button[data-action="delete"]:focus{
  outline:2px solid rgba(239,68,68,0.18);
  outline-offset:2px;
}

/* Main editor column */
.editor-main{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
}

/* Toolbar */
.editor-toolbar{
  padding:12px 16px;
  background:linear-gradient(180deg, rgba(255,255,255,0.8), rgba(250,250,252,0.9));
  border-bottom:1px solid rgba(15,23,42,0.04);
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}
.editor-toolbar .toolbar-group{display:flex;gap:8px;align-items:center}
.editor-toolbar .btn{background:var(--accent);color:#fff;border-radius:6px;padding:8px 10px;border:none;box-shadow:0 1px 0 rgba(0,0,0,0.06)}
.editor-toolbar .btn.small{padding:6px 8px;font-size:0.9rem}
.editor-toolbar select{padding:8px;border-radius:6px;border:1px solid #e6eef8}
.editor-toolbar #doc-name{margin-left:8px;color:var(--muted);font-weight:600}
.editor-toolbar #save-indicator{margin-left:6px}
/* Docs toggle - hidden by default on wide screens */
.editor-toolbar #docs-toggle{display:none}

/* Editor content area (document canvas) */
.editor-content{
  flex:1 1 auto;
  padding:28px 36px;
  overflow:auto;
  background:transparent;
}
.editor-content word-editor{display:block;height:100%;}
word-editor > div[contenteditable]{
  min-height:480px;
  max-width:900px;
  margin:0 auto;
  background:var(--surface);
  border-radius:var(--radius);
  padding:32px;
  box-shadow:0 8px 24px rgba(16,24,40,0.06);
  line-height:1.6;
  color:#111827;
  outline:none;
}
word-editor p{margin:0 0 1rem}

/* Status bar */
.status-bar{
  padding:10px 16px;
  background:var(--surface);
  border-top:1px solid rgba(15,23,42,0.04);
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:0.95rem;
  color:var(--muted);
}

/* Responsive */
@media (max-width: 900px){
  /* On small screens the documents panel becomes a full-width top panel and is collapsible */
  .documents-panel{display:block;width:100%;order:-1;box-shadow:none;border-right:none;border-bottom:1px solid rgba(15,23,42,0.04)}
  .documents-panel.collapsed{display:none}
  .editor-toolbar #docs-toggle{display:inline-flex}
  word-editor > div[contenteditable]{min-height:360px;padding:20px}
}

@media (max-width: 480px){
  .editor-toolbar{padding:8px;gap:8px}
  .editor-toolbar .btn{padding:6px}
  word-editor > div[contenteditable]{padding:14px}
}

/* Small helpers */
.hidden{display:none}
