/* ============================================
   TELEFAX-ÜBERMITTLUNGSSTELLE v3.11
   Windows 95 Authentisches Design
   ============================================ */

/* === RESET === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === WIN95 FONT === */
@font-face {
    font-family: 'W95FA';
    src: url('https://unpkg.com/windows-95-font@1.0.2/w95fa.woff2') format('woff2'),
         url('https://unpkg.com/windows-95-font@1.0.2/w95fa.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* === CSS VARIABLES === */
:root {
    --win-bg: #c0c0c0;
    --win-light: #ffffff;
    --win-mid: #dfdfdf;
    --win-dark: #808080;
    --win-darker: #404040;
    --win-black: #0a0a0a;
    --win-blue: #000080;
    --win-blue-light: #1084d0;
    --win-teal: #008080;
    --win-white: #ffffff;
    --win-field-bg: #ffffff;
    --win-font: 'W95FA', 'MS Sans Serif', 'Microsoft Sans Serif', 'Tahoma', sans-serif;
    --win-font-size: 11px;
    --win-progress: #000080;
}

/* === BODY / DESKTOP === */
body {
    font-family: var(--win-font);
    font-size: var(--win-font-size);
    background-color: var(--win-teal);
    color: #000;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    cursor: default;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
    image-rendering: pixelated;
}

.desktop {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8px;
    padding-top: 20px;
    padding-bottom: 36px;
    overflow-y: auto;
}

/* === 3D BORDER MIXINS (via classes) === */
.raised {
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid), inset -1px -1px 0 var(--win-black);
}

.sunken {
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black), inset -1px -1px 0 var(--win-mid);
}

/* === WINDOW === */
.window {
    background: var(--win-bg);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid), inset -1px -1px 0 var(--win-black),
                2px 2px 8px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 540px;
}

.title-bar {
    background: linear-gradient(90deg, var(--win-blue), var(--win-blue-light));
    color: var(--win-white);
    font-weight: bold;
    padding: 2px 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    min-height: 20px;
}

.title-bar-text {
    font-size: var(--win-font-size);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 2px;
    letter-spacing: 0.3px;
}

.title-bar-controls {
    display: flex;
    gap: 1px;
    flex-shrink: 0;
}

.title-btn {
    font-family: var(--win-font);
    width: 16px;
    height: 14px;
    font-size: 9px;
    line-height: 1;
    padding: 0;
    background: var(--win-bg);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid), inset -1px -1px 0 var(--win-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.title-btn:active {
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black), inset -1px -1px 0 var(--win-mid);
}

/* === MENU BAR === */
.menu-bar {
    background: var(--win-bg);
    padding: 1px 0;
    border-bottom: 1px solid var(--win-dark);
    display: flex;
    gap: 0;
}

.menu-item {
    padding: 2px 8px;
    cursor: pointer;
    font-size: var(--win-font-size);
}

.menu-item:first-child {
    text-decoration: underline;
    text-underline-offset: 1px;
}

.menu-item:hover {
    background: var(--win-blue);
    color: var(--win-white);
}

/* === WINDOW BODY === */
.window-body {
    padding: 8px;
}

/* === STATUS LINE (oben im Fenster) === */
.status-line {
    background: var(--win-field-bg);
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black);
    padding: 3px 6px;
    margin-bottom: 8px;
    font-size: var(--win-font-size);
    color: #006400;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-icon {
    font-size: 12px;
}

/* === BUTTONS === */
.btn {
    font-family: var(--win-font);
    font-size: var(--win-font-size);
    background: var(--win-bg);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid), inset -1px -1px 0 var(--win-black);
    padding: 3px 10px;
    cursor: pointer;
    min-height: 21px;
    color: #000;
    white-space: nowrap;
}

.btn:active {
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black), inset -1px -1px 0 var(--win-mid);
    padding: 4px 9px 2px 11px;
}

.btn:focus-visible {
    outline: 1px dotted #000;
    outline-offset: -4px;
}

.btn-hidden {
    display: none !important;
}

.btn-submit {
    font-weight: bold;
    padding: 4px 16px;
    min-height: 26px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-icon {
    font-size: 14px;
}

.btn-ok {
    min-width: 80px;
    margin-top: 8px;
}

/* === FIELDSET / FIELD GROUP === */
fieldset.field-group {
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    padding: 8px;
    margin-bottom: 8px;
}

fieldset.field-group legend {
    font-weight: bold;
    padding: 0 4px;
    font-size: var(--win-font-size);
}

label {
    display: block;
    margin-bottom: 3px;
    font-size: var(--win-font-size);
}

input[type="text"],
textarea {
    font-family: var(--win-font);
    font-size: var(--win-font-size);
    width: 100%;
    padding: 2px 4px;
    background: var(--win-field-bg);
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black), inset -1px -1px 0 var(--win-mid);
    color: #000;
    outline: none;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.4;
}

input[type="file"] {
    font-family: var(--win-font);
    font-size: var(--win-font-size);
    margin-top: 4px;
}

/* === TABS === */
.tabs-container {
    margin-bottom: 8px;
}

.tabs {
    display: flex;
    gap: 0;
    padding-left: 2px;
    position: relative;
    z-index: 2;
}

.tab {
    font-family: var(--win-font);
    font-size: var(--win-font-size);
    background: var(--win-bg);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-bg) var(--win-light);
    border-bottom: none;
    padding: 3px 8px;
    cursor: pointer;
    position: relative;
    top: 2px;
    z-index: 1;
    color: #000;
    box-shadow: inset 1px 1px 0 var(--win-mid);
}

.tab:not(.active) {
    background: #b4b4b4;
    top: 3px;
}

.tab.active {
    z-index: 3;
    font-weight: bold;
    padding-bottom: 5px;
    background: var(--win-bg);
}

/* === TAB PANELS === */
.tab-panel {
    display: none;
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid);
    padding: 10px;
    background: var(--win-bg);
    position: relative;
    z-index: 1;
}

.tab-panel.active {
    display: block;
}

.panel-hint {
    font-size: var(--win-font-size);
    color: #444;
    margin-bottom: 8px;
    font-style: italic;
}

/* === SUNKEN PANEL (Sendeprotokoll) === */
.sunken-panel {
    background: var(--win-field-bg);
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black), inset -1px -1px 0 var(--win-mid);
    padding: 8px 10px;
    margin-bottom: 8px;
}

.protokoll-table {
    width: 100%;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 11px;
    border-collapse: collapse;
}

.protokoll-table td {
    padding: 1px 4px;
    vertical-align: top;
}

.proto-label {
    font-weight: bold;
    white-space: nowrap;
    width: 80px;
    color: #444;
}

.proto-value {
    color: #000;
}

.proto-ok {
    color: #006400;
    font-weight: bold;
    letter-spacing: 1px;
}

/* === PROGRESS BAR === */
.progress-trough {
    width: 100%;
    height: 16px;
    background: var(--win-field-bg);
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black);
    margin: 8px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: repeating-linear-gradient(
        90deg,
        var(--win-progress) 0px,
        var(--win-progress) 8px,
        transparent 8px,
        transparent 10px
    );
    transition: width 0.4s linear;
}

/* === CAMERA === */
.camera-container {
    margin-bottom: 8px;
    position: relative;
}

#camera-preview,
#camera-snapshot {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    background: #000;
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black);
    display: block;
}

#camera-canvas {
    display: none;
}

#camera-preview:not([src]):not(.active-cam),
#camera-snapshot:not([src]) {
    display: none;
}

.camera-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* === UPLOAD === */
.file-upload-row {
    margin-top: 4px;
}

.upload-preview {
    margin-top: 6px;
    font-size: var(--win-font-size);
    color: #444;
    font-family: 'Courier New', monospace;
}

/* === DIALOGS === */
.dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: 380px;
    width: calc(100% - 24px);
    display: none;
}

.dialog.visible {
    display: block;
}

.dialog-body {
    text-align: center;
    padding: 12px 16px;
}

.dialog-icon-row {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dialog-checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #006400;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    border-radius: 0;
}

.dialog-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #c00;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}

.sende-status {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 4px;
}

.sende-detail {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
}

/* === FAX MACHINE ANIMATION === */
.fax-machine {
    width: 60px;
    height: 40px;
    position: relative;
    margin: 0 auto 4px;
}

.fax-body {
    width: 60px;
    height: 30px;
    background: var(--win-bg);
    border: 2px solid var(--win-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    color: var(--win-dark);
    position: absolute;
    bottom: 0;
}

.fax-paper {
    width: 40px;
    height: 0px;
    background: #fff;
    border: 1px solid #ccc;
    position: absolute;
    top: 10px;
    left: 10px;
    transition: height 0.3s ease;
    overflow: hidden;
}

.fax-paper::after {
    content: '────────\A────────\A────────\A────────';
    white-space: pre;
    font-size: 5px;
    color: #999;
    padding: 1px;
    display: block;
}

.fax-paper.feeding {
    animation: paper-feed 2s ease-in-out infinite;
}

@keyframes paper-feed {
    0% { height: 0px; top: 10px; }
    30% { height: 20px; top: -10px; }
    60% { height: 15px; top: -5px; }
    100% { height: 0px; top: 10px; }
}

/* === SUBMIT ROW === */
.submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 6px;
}

/* === WINDOW STATUSBAR === */
.window-statusbar {
    display: flex;
    border-top: 2px solid var(--win-dark);
    padding: 2px;
    gap: 2px;
}

.statusbar-field {
    font-size: 10px;
    padding: 1px 4px;
    border: 1px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.statusbar-main {
    flex: 1;
}

/* === CLIPPY (Karl-Heinz, Büroassistent) === */
#clippy {
    position: fixed;
    bottom: 36px;
    right: 12px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Sprechblase */
.clippy-bubble {
    background: #ffffcc;
    border: 2px solid #000;
    border-radius: 4px;
    padding: 8px 24px 8px 8px;
    max-width: 240px;
    font-size: 11px;
    line-height: 1.4;
    position: relative;
    margin-bottom: 6px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    display: none;
    animation: clippy-fade 0.3s ease;
}

.clippy-bubble.visible {
    display: block;
}

@keyframes clippy-fade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.clippy-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffcc;
}

.clippy-bubble::before {
    content: '';
    position: absolute;
    bottom: -11px;
    right: 19px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid #000;
}

.clippy-bubble-close {
    position: absolute;
    top: 2px;
    right: 4px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0 2px;
}

.clippy-bubble-close:hover {
    color: #000;
}

.clippy-bubble-text {
    color: #333;
}

/* Clippy GIF */
.clippy-gif {
    width: 80px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s;
    image-rendering: auto;
}

.clippy-gif:hover {
    transform: scale(1.1);
}

.clippy-gif:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 560px) {
    #clippy {
        bottom: 40px;
        right: 6px;
    }

    .clippy-bubble {
        max-width: 200px;
        font-size: 12px;
    }

    .clippy-gif {
        width: 64px;
    }
}

/* === OVERLAY === */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.15);
    z-index: 999;
    display: none;
}

.overlay.visible {
    display: block;
}

/* === TASKBAR === */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: var(--win-bg);
    border-top: 2px solid var(--win-light);
    display: flex;
    align-items: center;
    padding: 2px 2px;
    z-index: 2000;
    gap: 2px;
}

.btn-start {
    font-weight: bold;
    font-size: var(--win-font-size);
    padding: 1px 6px;
    min-height: 22px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.start-logo {
    font-size: 14px;
    line-height: 1;
}

.taskbar-divider {
    width: 2px;
    height: 20px;
    border-left: 1px solid var(--win-dark);
    border-right: 1px solid var(--win-light);
    margin: 0 1px;
}

.taskbar-button {
    font-family: var(--win-font);
    font-size: var(--win-font-size);
    padding: 1px 6px;
    min-height: 20px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid), inset -1px -1px 0 var(--win-black);
    display: flex;
    align-items: center;
}

.taskbar-button.active {
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-black), inset -1px -1px 0 var(--win-mid);
    font-weight: bold;
    background: repeating-linear-gradient(
        45deg,
        var(--win-bg),
        var(--win-bg) 2px,
        #b8b8b8 2px,
        #b8b8b8 4px
    );
}

.taskbar-spacer {
    flex: 1;
}

.tray {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 2px solid;
    border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
    padding: 0 4px;
    height: 22px;
}

.tray-icon {
    font-size: 12px;
    cursor: pointer;
}

.taskbar-clock {
    font-size: var(--win-font-size);
    min-width: 40px;
    text-align: center;
}

/* === RESPONSIVE === */
@media (max-width: 560px) {
    :root {
        --win-font-size: 13px;
    }

    .desktop {
        padding: 4px;
        padding-top: 8px;
        padding-bottom: 32px;
        align-items: flex-start;
    }

    .window {
        max-width: 100%;
        max-height: none;
    }

    .tab {
        font-size: 12px;
        padding: 5px 6px;
    }

    .tabs {
        flex-wrap: wrap;
        gap: 0;
    }

    .tab {
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .btn {
        min-height: 28px;
        padding: 4px 12px;
    }

    .btn-submit {
        width: 100%;
        justify-content: center;
        min-height: 32px;
        font-size: 14px;
    }

    textarea {
        min-height: 80px;
    }

    input[type="text"] {
        min-height: 28px;
    }

    .title-bar-text {
        font-size: 12px;
    }

    .taskbar {
        height: 32px;
    }

    .taskbar-button {
        display: none;
    }

    .menu-bar {
        display: none;
    }

    .window-statusbar {
        display: none;
    }
}

/* === SELECTION COLOR === */
::selection {
    background: var(--win-blue);
    color: var(--win-white);
}

/* === SCROLLBAR (Webkit) === */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: repeating-linear-gradient(
        45deg,
        var(--win-bg),
        var(--win-bg) 2px,
        #fff 2px,
        #fff 4px
    );
}

::-webkit-scrollbar-thumb {
    background: var(--win-bg);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: inset 1px 1px 0 var(--win-mid), inset -1px -1px 0 var(--win-black);
}

::-webkit-scrollbar-button {
    background: var(--win-bg);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    height: 16px;
    width: 16px;
}
