/* ============================================================
   PPT Master - SVG Editor  |  Dark theme, three-panel layout
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #e0e0e0;
    background: #1a1a2e;
    overflow: hidden;
}

/* ---------- App shell ---------- */
#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ======================== LEFT PANEL ======================== */
#panel-left {
    width: 200px;
    min-width: 200px;
    background: #16162a;
    border-right: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#panel-left .panel-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

#slide-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.slide-list-empty {
    padding: 12px 16px;
    color: #5a5a7a;
    font-size: 13px;
    line-height: 1.5;
}

/* Scrollbar */
#slide-list::-webkit-scrollbar {
    width: 6px;
}
#slide-list::-webkit-scrollbar-track {
    background: transparent;
}
#slide-list::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 3px;
}

/* Slide item */
.slide-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}

.slide-item:hover {
    background: #1f1f38;
}

.slide-item.active {
    background: #1e3a5f;
    border-left-color: #4a9eff;
}

.slide-item.slide-error {
    border-left-color: #ef4444;
}

.slide-item.slide-error .slide-name {
    color: #fca5a5;
}

.slide-item.slide-error .slide-name::before {
    content: "⚠ ";
    color: #ef4444;
}

.slide-item .slide-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.slide-item .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #f5c542;
    color: #1a1a2e;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* ======================== CENTER PANEL ======================== */
#panel-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    background: #12121f;
    overflow: hidden;
}

#slide-nav {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #2a2a4a;
    background: #16162a;
    user-select: none;
}

.nav-btn {
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #c0c0d8;
    background: transparent;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nav-btn:hover:not(:disabled) {
    color: #ffffff;
    background: #2a2a4a;
    border-color: #5a5a7a;
}

.nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#nav-label {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 220px;
    max-width: 480px;
    padding: 0 6px;
    font-size: 13px;
    color: #c0c0d8;
    justify-content: center;
}

#nav-counter {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #f5c542;
    white-space: nowrap;
}

#nav-name {
    color: #8a8aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#svg-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 24px;
    position: relative;
}

#svg-placeholder {
    color: #5a5a7a;
    font-size: 16px;
    user-select: none;
}

#svg-content {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
    overflow: visible;
    position: relative;
}

#svg-content svg {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 72px);
    height: auto;
}

/* ---------- SVG element interaction states ---------- */
.svg-selectable {
    cursor: pointer;
    transition: outline 0.12s ease;
}

.svg-selectable:hover {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.svg-selected {
    outline: 2px solid #4a9eff !important;
    outline-offset: 2px;
}

.svg-annotated {
    outline: 2px solid #f59e0b !important;
    outline-offset: 2px;
}

/* ======================== RIGHT PANEL ======================== */
#panel-right {
    width: 280px;
    min-width: 280px;
    background: #16162a;
    border-left: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#panel-right .panel-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

/* --- Selection info --- */
#selection-info {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

.section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #7a7a9a;
    margin-bottom: 8px;
    font-weight: 600;
}

#selected-element {
    font-size: 13px;
    word-break: break-all;
}

#selected-element.empty {
    color: #5a5a7a;
    font-style: italic;
}

#selected-element .el-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #2a2a4a;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    color: #7ab4ff;
    margin-right: 6px;
}

#selected-element .el-id {
    font-size: 12px;
    color: #a0a0c0;
}

/* --- Annotation input --- */
#annotation-input {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

#annotation-text {
    width: 100%;
    min-height: 80px;
    max-height: 160px;
    resize: vertical;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    color: #e0e0e0;
    background: #1e1e36;
    border: 1px solid #3a3a5a;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

#annotation-text:focus {
    border-color: #4a9eff;
}

#annotation-text::placeholder {
    color: #5a5a7a;
}

#btn-add-annotation {
    margin-top: 10px;
    width: 100%;
    padding: 9px 0;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #4a9eff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

#btn-add-annotation:hover {
    background: #3a8eef;
}

#btn-add-annotation:active {
    background: #2a7edf;
}

/* --- Annotation list --- */
#annotation-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

#annotation-list::-webkit-scrollbar {
    width: 6px;
}
#annotation-list::-webkit-scrollbar-track {
    background: transparent;
}
#annotation-list::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 3px;
}

#annotations {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annotation-item {
    background: #1e1e36;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.annotation-item .ann-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.annotation-item .ann-tag {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 11px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.annotation-item .ann-id {
    font-size: 11px;
    color: #7a7a9a;
}

.annotation-item .ann-remove {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 3px;
    transition: background 0.15s;
}

.annotation-item .ann-remove:hover {
    background: rgba(255, 107, 107, 0.15);
}

.annotation-item .ann-text {
    font-size: 13px;
    color: #c0c0d8;
    word-break: break-word;
    white-space: pre-wrap;
}

.annotations-empty {
    color: #5a5a7a;
    font-size: 13px;
    font-style: italic;
}

/* --- Action buttons --- */
#preview-actions {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.btn-lang-toggle {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    min-width: 34px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #c0c0d8;
    background: transparent;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-lang-toggle:hover {
    color: #ffffff;
    background: #2a2a4a;
    border-color: #5a5a7a;
}

#btn-save {
    padding: 11px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    background: #f5c542;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

#btn-save:hover {
    background: #e5b532;
}

#btn-save:active {
    background: #d5a522;
}

#btn-exit-preview {
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #c0c0d8;
    background: transparent;
    border: 1px solid #3a3a5a;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#btn-exit-preview:hover {
    color: #ffffff;
    background: #2a2a4a;
    border-color: #5a5a7a;
}

#btn-exit-preview:active {
    background: #1e1e36;
}

/* ======================== MODAL ======================== */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#modal {
    background: #1e1e36;
    border: 1px solid #3a3a5a;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

#modal-message {
    font-size: 14px;
    line-height: 1.7;
    color: #d0d0e8;
    margin-bottom: 20px;
    white-space: pre-line;
    text-align: left;
}

#modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

#modal-confirm {
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    background: #f5c542;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

#modal-confirm:hover {
    background: #e5b532;
}

#modal-cancel {
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 600;
    color: #a0a0c0;
    background: transparent;
    border: 1px solid #3a3a5a;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

#modal-cancel:hover {
    background: #2a2a4a;
}

/* --- Element properties --- */
#element-props {
    margin-top: 10px;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.prop-table {
    width: 100%;
    border-collapse: collapse;
}

.prop-table tr {
    border-bottom: 1px solid #2a2a4a;
}

.prop-table tr:last-child {
    border-bottom: none;
}

.prop-table td {
    padding: 4px 0;
    vertical-align: top;
}

.prop-table .prop-key {
    color: #7a7a9a;
    width: 80px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.prop-table .prop-val {
    color: #c0c0d8;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    word-break: break-all;
}

.prop-table .prop-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid #3a3a5a;
}

.multi-el-list {
    margin-top: 6px;
    max-height: 100px;
    overflow-y: auto;
    font-size: 11px;
}

.multi-el-item {
    padding: 2px 0;
    color: #7a7a9a;
}

.multi-el-item .el-tag {
    font-size: 10px;
    margin-right: 4px;
}

.multi-summary {
    margin-top: 8px;
    font-size: 12px;
    color: #a0a0c0;
}

/* --- Multi-select count --- */
.multi-count {
    color: #4a9eff;
    font-weight: 600;
    font-size: 14px;
}

/* --- Rubber band selection --- */
#rubber-band-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    cursor: crosshair;
}

#rubber-band-overlay.active {
    pointer-events: auto;
}

#rubber-band {
    position: fixed;
    border: 2px dashed #4a9eff;
    background: rgba(74, 158, 255, 0.15);
    pointer-events: none;
    z-index: 11;
}

/* ======================== UTILITY ======================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
