/* Microsoft Word Website Editor - Complete Stylesheet */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --ribbon-bg: #f8fafc;
    --workspace-bg: #e2e8f0;
    --page-bg: #ffffff;
    --text-color: #0f172a;
    --border-color: #cbd5e1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--workspace-bg);
}

/* App Header Topbar */
.app-header {
    background: #1e293b;
    color: #ffffff;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 14px;
    flex-shrink: 0;
    user-select: none;
}

.doc-title-input {
    background: transparent;
    border: 1px solid transparent;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s;
    width: 250px;
}

.doc-title-input:hover, .doc-title-input:focus {
    background: #334155;
    border-color: #475569;
}

/* Side Menu Drawer */
.side-menu-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background-color: #0f172a;
    color: #ffffff;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.side-menu-drawer.active {
    left: 0;
}

.side-menu-header {
    padding: 0 20px 15px 20px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.side-menu-header h3 {
    font-size: 16px;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-menu-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-menu-btn:hover {
    color: #ffffff;
}

.side-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.side-menu-item {
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    color: #e2e8f0;
    text-align: left;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.side-menu-item:hover {
    background: #1e293b;
    color: #38bdf8;
}

.menu-section-title {
    padding: 15px 20px 5px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 700;
}

/* Ribbon / Toolbar Header */
.ribbon-container {
    background-color: #ffffff;
    border-bottom: 2px solid #cbd5e1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    z-index: 10;
    flex-shrink: 0;
}

.ribbon-tabs {
    display: flex;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 10px;
    overflow-x: auto;
}

.main-menu-trigger {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    white-space: nowrap;
}

.main-menu-trigger:hover {
    background: #1d4ed8;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #1e293b;
    background-color: #e2e8f0;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 600;
    background-color: #ffffff;
}

/* Ribbon Toolbar Controls */
.ribbon-toolbar {
    padding: 8px 15px;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    background: #ffffff;
}

.tab-content {
    display: none;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.tab-content.active {
    display: flex;
}

.btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 12px;
    border-right: 1px solid #e2e8f0;
}

.btn-group:last-child {
    border-right: none;
}

.btn-group button, .btn-group select, .btn-group label {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease-in-out;
}

.btn-group button:hover, .btn-group select:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.btn-group button:active {
    background: #e2e8f0;
}

.btn-group input[type="color"] {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
}

/* Workspace & A4 Document Container */
.workspace {
    flex: 1;
    background-color: var(--workspace-bg);
    overflow-y: auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
    transition: background-color 0.3s ease;
}

.workspace.dark-mode {
    background-color: #0f172a;
}

.workspace.dark-mode .document-page {
    background-color: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.workspace.dark-mode .page-header,
.workspace.dark-mode .page-footer {
    color: #94a3b8;
    border-color: #334155;
}

.pages-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    transform-origin: top center;
    transition: transform 0.2s ease;
}

/* Page Frame */
.document-page {
    width: 850px;
    min-width: 850px;
    height: 1100px;
    max-height: 1100px;
    background: #ffffff;
    padding: 60px 70px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #cbd5e1;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease;
}

.page-header, .page-footer {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.page-footer {
    border-bottom: none;
    border-top: 1px dashed #e2e8f0;
}

.page-content {
    flex: 1;
    outline: none;
    overflow: hidden;
    margin-top: 10px;
    margin-bottom: 10px;
}

.page-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Resizable Image Container */
.resizable-img-wrapper {
    display: inline-block;
    position: relative;
    margin: 5px;
    user-select: none;
}

.resizable-img-wrapper img {
    display: block;
    max-width: 100%;
}

.img-toolbar {
    position: absolute;
    top: -30px;
    left: 0;
    background: #1e293b;
    border-radius: 4px;
    padding: 2px 6px;
    display: none;
    gap: 6px;
    z-index: 100;
}

.resizable-img-wrapper:hover .img-toolbar {
    display: flex;
}

.img-toolbar button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 11px;
}

/* Table styling */
.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.page-content th, .page-content td {
    border: 1px solid #94a3b8;
    padding: 8px;
    text-align: left;
}

.page-content th {
    background-color: #f1f5f9;
}

/* Status Bar */
.status-bar {
    background: #f8fafc;
    border-top: 1px solid #cbd5e1;
    padding: 6px 16px;
    font-size: 12px;
    color: #475569;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    justify-content: space-between;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autosave-indicator {
    color: #16a34a;
    font-weight: 600;
    margin-left: 10px;
    transition: opacity 0.5s ease;
}

.restore-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 16px;
    font-size: 13px;
    display: none;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #fcd34d;
}

.restore-banner button {
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #d97706;
    background: #ffffff;
    cursor: pointer;
}

.restore-banner button.btn-action {
    background: #d97706;
    color: white;
}

/* Modal dialogs */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.modal-header h4 {
    color: #1e293b;
    font-size: 16px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.modal-body input, .modal-body select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
}

@media print {
    body * { visibility: hidden; }
    .workspace, .workspace * { visibility: visible; }
    .workspace { position: absolute; left: 0; top: 0; width: 100%; padding: 0; background: white; }
    .document-page { page-break-after: always; box-shadow: none; border: none; transform: none !important; }
}
