
/* ========================================
   TEXT STUDIO - DRAFT.
   Main Stylesheet
======================================== */


/* ========================================
   1. COLOUR VARIABLES
======================================== */

:root {
    --background: #191a17;
    --surface: #22231f;
    --surface-hover: #2b2c26;

    --text: #e9e7df;
    --text-muted: #85867b;

    --border: #30312b;

    --primary: #a0ad8b;
    --primary-hover: #b3c19d;

    --danger: #c77d70;
    --danger-hover: #b66c60;

    --editor-background: #191a17;

    --toolbar-background: #22231f;

    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}


/* LIGHT THEME */

body:not(.dark) {
    --background: #f5f2eb;
    --surface: #fffdf8;
    --surface-hover: #f0ede5;

    --text: #393a32;
    --text-muted: #918e83;

    --border: #e7e3d9;

    --primary: #788568;
    --primary-hover: #667456;

    --danger: #b85f53;
    --danger-hover: #a94e43;

    --editor-background: #fffdf8;

    --toolbar-background: #fffdf8;

    --shadow: 0 10px 30px rgba(57, 58, 50, 0.08);
}


/* ========================================
   2. GLOBAL STYLES
======================================== */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family: "DM Sans", "Segoe UI", Arial, sans-serif;

    background: var(--background);
    color: var(--text);

    overflow: hidden;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* ========================================
   3. MAIN APPLICATION
======================================== */

.app {
    width: 100%;
    height: 100vh;
    height: 100dvh;

    display: flex;
    flex-direction: column;

    background: var(--background);
    overflow: hidden;
}


/* ========================================
   4. HEADER
======================================== */

.header {
    min-height: 65px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 10px 22px;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}


/* BRAND */

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

.brand-icon {
    width: 39px;
    height: 39px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: linear-gradient(
        135deg,
        #a0ad8b,
        #788568
    );

    color: #191a17;

    border-radius: 11px;

    font-size: 23px;
    font-weight: bold;

    box-shadow: 0 3px 8px rgba(120, 133, 104, 0.2);
}

.brand-text h1 {
    margin: 0;

    font-size: 19px;
    font-weight: 700;

    letter-spacing: -0.5px;
}

.brand-text span {
    display: block;

    margin-top: 2px;

    font-size: 11px;
    color: var(--text-muted);
}


/* HEADER ACTIONS */

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.save-status {
    display: flex;
    align-items: center;
    gap: 7px;

    font-size: 12px;
    color: var(--text-muted);
}

.save-status::before {
    content: "";

    width: 8px;
    height: 8px;

    display: inline-block;

    background: var(--primary);

    border-radius: 50%;
}


/* THEME BUTTON */

.icon-button {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface);
    color: var(--text);

    font-size: 17px;

    transition: 0.2s;
}

.icon-button:hover {
    background: var(--surface-hover);
}


/* ========================================
   5. TOOLBAR
======================================== */

.toolbar {
    display: flex;
    align-items: center;

    flex-wrap: wrap;
    gap: 9px;

    padding: 11px 18px;

    background: var(--toolbar-background);

    border-bottom: 1px solid var(--border);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-divider {
    width: 1px;
    height: 28px;

    background: var(--border);

    margin: 0 5px;
}


/* TOOLBAR BUTTONS */

.tool-button {
    min-height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 7px 11px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: var(--surface);
    color: var(--text);

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;

    transition: all 0.15s ease;
}

.tool-button:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.tool-button:active {
    transform: scale(0.97);
}


/* PRIMARY BUTTON */

.tool-button.primary {
    background: var(--primary);

    border-color: var(--primary);

    color: #191a17;
}

.tool-button.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}


/* DANGER BUTTON */

.tool-button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fffdf8;
}

.tool-button.danger:hover {
    background: var(--danger-hover);
}


/* ACTIVE BUTTON */

.tool-button.active {
    background: rgba(160, 173, 139, 0.12);

    border-color: var(--primary);

    color: var(--primary);
}


/* FONT SIZE */

.font-size-display {
    min-width: 38px;

    text-align: center;

    font-size: 12px;
    color: var(--text-muted);
}


/* ========================================
   6. DOCUMENT BAR
======================================== */

.document-bar {
    min-height: 42px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 7px 22px;

    background: var(--background);

    border-bottom: 1px solid var(--border);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 12px;
    font-weight: 600;
}

.document-icon {
    font-size: 15px;
}

#filename {
    color: var(--text);
}

.unsaved-indicator {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #c49a69;
}

.text-button {
    border: none;
    background: transparent;

    color: var(--text-muted);

    font-size: 11px;

    padding: 5px 8px;
}

.text-button:hover {
    color: var(--danger);
}


/* ========================================
   7. FIND AND REPLACE PANEL
======================================== */

.find-panel {
    padding: 11px 20px;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}

.find-panel[hidden] {
    display: none !important;
}

.find-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.find-row + .find-row {
    margin-top: 9px;
}

.find-row input {
    width: 210px;
    max-width: 100%;

    padding: 8px 11px;

    border: 1px solid var(--border);
    border-radius: 6px;

    background: var(--background);
    color: var(--text);

    font-size: 12px;
}

.find-row input:focus {
    border-color: var(--primary);
    outline: none;
}

#findResults {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 65px;
}

.small-button {
    min-width: 32px;
    height: 30px;

    padding: 5px 9px;

    border: 1px solid var(--border);
    border-radius: 6px;

    background: var(--surface);
    color: var(--text);

    font-size: 12px;
}

.small-button:hover {
    background: var(--surface-hover);
}


/* ========================================
   8. EDITOR
======================================== */

.editor-container {
    flex: 1;

    min-height: 0;

    display: flex;

    background-color: var(--editor-background);

    background-image: radial-gradient(
        circle,
        rgba(190, 194, 170, 0.10) 1px,
        transparent 1px
    );

    background-size: 25px 25px;

    overflow: hidden;
}

#editor {
    width: 100%;
    height: 100%;

    flex: 1;

    padding: 30px 38px;

    border: none;
    outline: none;

    resize: none;

    background: transparent;

    color: var(--text);

    font-family: Consolas, "Courier New", monospace;

    font-size: 16px;
    line-height: 1.75;

    tab-size: 4;

    white-space: pre-wrap;
    overflow-wrap: break-word;

    caret-color: var(--primary);
}

#editor::placeholder {
    color: var(--text-muted);
    opacity: 0.65;
}

#editor:focus {
    outline: none;
}


/* WORD WRAP OFF */

#editor.no-wrap {
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}


/* ========================================
   9. STATUS BAR
======================================== */

.statusbar {
    min-height: 37px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-wrap: wrap;

    gap: 8px;

    padding: 6px 20px;

    background: var(--surface);

    border-top: 1px solid var(--border);

    font-size: 11px;
    color: var(--text-muted);
}

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

.status-divider {
    color: var(--border);
}


/* ========================================
   10. MODAL BACKGROUND
======================================== */

.modal {
    position: fixed;
    inset: 0;

    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 18px;

    background: rgba(10, 11, 9, 0.75);

    backdrop-filter: blur(5px);
}

.modal[hidden] {
    display: none !important;
}


/* ========================================
   11. MODAL CONTENT
======================================== */

.modal-content {
    width: 390px;
    max-width: 100%;

    padding: 23px;

    background: var(--surface);

    color: var(--text);

    border: 1px solid var(--border);

    border-radius: 13px;

    box-shadow: var(--shadow);

    animation: modalAppear 0.2s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* MODAL HEADER */

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 18px;
}

.modal-header h2 {
    margin: 0;

    font-size: 19px;
    font-weight: 700;
}

.close-button {
    width: 30px;
    height: 30px;

    border: none;
    border-radius: 6px;

    background: transparent;

    color: var(--text-muted);

    font-size: 17px;
}

.close-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}


/* MODAL BODY */

.modal-body label {
    display: block;

    margin: 13px 0 7px;

    font-size: 12px;
    font-weight: 600;

    color: var(--text-muted);
}

.modal-body input,
.modal-body select {
    width: 100%;

    padding: 11px 12px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: var(--background);

    color: var(--text);

    font-size: 13px;
}

.modal-body input:focus,
.modal-body select:focus {
    border-color: var(--primary);
    outline: none;
}

.modal-body p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
}


/* MODAL FOOTER */

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    flex-wrap: wrap;
    gap: 8px;

    margin-top: 24px;
}


/* ========================================
   12. SCROLLBARS
======================================== */

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: #45473d;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666b58;
}


/* ========================================
   13. RESPONSIVE DESIGN
======================================== */

@media (max-width: 900px) {

    .toolbar {
        gap: 7px;
        padding: 9px 12px;
    }

    .toolbar-divider {
        margin: 0 2px;
    }

    #editor {
        padding: 23px;
    }

}


@media (max-width: 600px) {

    .header {
        min-height: 57px;
        padding: 8px 12px;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
        font-size: 19px;
    }

    .brand-text h1 {
        font-size: 16px;
    }

    .brand-text span {
        font-size: 10px;
    }

    .save-status {
        font-size: 10px;
    }

    .toolbar {
        padding: 9px;
        gap: 6px;
    }

    .tool-button {
        min-height: 32px;
        padding: 6px 8px;
        font-size: 11px;
    }

    .toolbar-divider {
        height: 23px;
    }

    .document-bar {
        padding: 7px 12px;
    }

    .find-panel {
        padding: 9px;
    }

    .find-row input {
        width: 135px;
    }

    #editor {
        padding: 17px;
        font-size: 14px;
    }

    .statusbar {
        padding: 8px 10px;
        font-size: 10px;
    }

    .status-left,
    .status-right {
        gap: 7px;
    }

}


@media (max-width: 380px) {

    .save-status {
        display: none;
    }

    .toolbar {
        gap: 4px;
    }

    .tool-button {
        padding: 6px;
        font-size: 10px;
    }

    .statusbar {
        font-size: 9px;
    }

}


/* ==========================================
   14. EDITABLE FILENAME
========================================== */

#filename {
    width: 200px;
    max-width: 45vw;
    padding: 6px 9px;

    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;

    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    outline: none;
    transition: 0.2s ease;
}

#filename:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

#filename:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(160, 173, 139, 0.12);
}


/* ========================================
   END OF TEXT STUDIO STYLESHEET
======================================== */
