/* Basis-Styles */
:root {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --toolbar-bg: #2a2a2a;
    --statusbar-bg: #2a2a2a;
    --border-color: #3a3a3a;
    --header-bg: #2a2a2a;
    --tab-inactive-bg: #3a3a3a;
    --tab-active-bg: #1a1a1a;
    --tab-border-color: #3a3a3a;
    --accent-color: #4a90e2;
    --accent-color-hover: #357abd;
}

body.light-mode {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --toolbar-bg: #f0f0f0;
    --statusbar-bg: #f0f0f0;
    --border-color: #e0e0e0;
    --header-bg: #f0f0f0;
    --tab-inactive-bg: #e0e0e0;
    --tab-active-bg: #ffffff;
    --tab-border-color: #e0e0e0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--bg-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

header {
    background-color: var(--header-bg);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    gap: 0.5rem;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

header h1 {
    font-size: 1.2rem;
    margin: 0;
}

#tabs-container {
    display: flex;
    flex-grow: 1;
    margin: 0 1rem;
    overflow-x: auto;
    gap: 2px;
}

.tab {
    background-color: var(--tab-inactive-bg);
    border: 1px solid var(--tab-border-color);
    border-bottom: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
    max-width: 200px;
    user-select: none;
}

.tab.active {
    background-color: var(--tab-active-bg);
    border-bottom-color: var(--tab-active-bg);
}

.tab-title {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

.tab-title:hover {
    background-color: var(--border-color);
}

.tab-title:focus {
    background-color: var(--border-color);
    outline: none;
    box-shadow: 0 0 0 2px var(--border-color);
    user-select: text;
}

.tab-title[contenteditable="true"] {
    background-color: var(--border-color);
    outline: none;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: text;
    user-select: text;
}

.tab .close-tab {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 0.2rem;
    line-height: 1;
    opacity: 0.7;
}

.tab .close-tab:hover {
    opacity: 1;
}

#add-tab-button {
    background: none;
    border: 1px solid var(--tab-border-color);
    border-bottom: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    background-color: var(--tab-inactive-bg);
}

#header-right {
    display: flex;
    align-items: center;
}

#dark-mode-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#toolbar {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    justify-content: space-between;
}

#toolbar .left-buttons {
    display: flex;
    gap: 5px;
}

#toolbar button, #toolbar select {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toolbar button:hover,
#toolbar select:hover {
    background-color: var(--border-color);
}

#toolbar select option {
    background-color: var(--toolbar-bg);
    color: var(--text-color);
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#editor {
    flex: 1;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    min-height: 80vh;
    background: var(--bg-color);
    color: var(--text-color);
    border: none;
    resize: none;
    outline: none;
}

.scroll-spacer {
    height: 100vh;
    width: 100%;
}

.features-section {
    padding: 40px 20px;
    background: var(--bg-color);
    color: var(--text-color);
    margin-top: 20px;
    text-align: center;
}

.features-section h2 {
    margin-bottom: 20px;
}

.features-section p {
    margin-bottom: 30px;
    font-size: 1.1em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.feature-tile {
    background: var(--toolbar-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.feature-tile .check {
    color: #4CAF50;
    font-size: 1.2em;
}

#statusbar {
    background-color: var(--statusbar-bg);
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
}

#statusbar > div {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#offline-indicator {
    display: none;
    color: #ff4444;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(255, 68, 68, 0.1);
}

#offline-indicator.visible {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

#save-status {
    transition: color 0.3s ease;
}

#save-status.error {
    color: #ff4444;
}

/* Formatierung */
[contenteditable="true"]:focus {
    outline: none;
}

.bold {
    font-weight: bold;
}

.italic {
    font-style: italic;
}

.underline {
    text-decoration: underline;
}

.strikethrough {
    text-decoration: line-through;
}

h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0;
}

h2 {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0.8rem 0;
}

h3 {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0.6rem 0;
}

p {
    margin: 0.5rem 0;
}

ul {
    list-style-type: disc;
    margin-left: 1.5rem;
}

code {
    font-family: 'Courier New', Courier, monospace;
    background-color: #333;
    padding: 2px 4px;
    border-radius: 4px;
}

pre code {
    display: block;
    padding: 1rem;
    overflow-x: auto;
}

.hidden {
    display: none !important;
}

#search-replace-bar {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--toolbar-bg);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 400px;
}

#search-replace-bar.hidden {
    display: none;
}

#search-replace-bar .search-row,
#search-replace-bar .replace-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#search-replace-bar .options-row {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

#search-replace-bar input[type="text"] {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

#search-replace-bar button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

#search-replace-bar button:hover {
    background-color: var(--border-color);
}

#search-replace-bar label {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

#search-replace-bar input[type="checkbox"] {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #app {
        max-width: 100%;
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1rem;
    }

    #toolbar {
        padding: 5px;
        gap: 3px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    #toolbar .left-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        flex: 1;
    }

    #toolbar button {
        padding: 5px;
        min-width: 32px;
        height: 32px;
        font-size: 14px;
    }

    #toolbar select {
        padding: 5px;
        height: 32px;
        font-size: 14px;
    }

    #share {
        font-size: 1rem !important;
        padding: 6px 12px !important;
        min-width: auto !important;
        margin-left: auto !important;
    }

    #share::after {
        content: "" !important;
    }

    #share::before {
        margin: 0 !important;
    }

    /* Verstecke weniger wichtige Buttons im mobilen Layout */
    #font-family,
    #format-block,
    #print,
    #open-file {
        display: none;
    }

    #search-replace-bar {
        min-width: 90%;
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    #tabs-container {
        margin: 0 0.5rem;
    }

    .tab {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    #statusbar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        font-size: 0.8rem;
    }

    #statusbar > div {
        justify-content: center;
    }

    #toolbar {
        padding: 3px;
    }

    #toolbar button {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }

    #toolbar select {
        height: 28px;
        font-size: 12px;
    }

    #share {
        padding: 4px 8px !important;
        font-size: 0.9rem !important;
    }
}

/* Optimierung für sehr kleine Bildschirme */
@media (max-width: 360px) {
    #toolbar .left-buttons {
        gap: 2px;
    }

    #toolbar button {
        min-width: 24px;
        height: 24px;
        font-size: 11px;
        padding: 3px;
    }

    #share {
        padding: 3px 6px !important;
        font-size: 0.8rem !important;
    }
}

/* Styles for Share Options */
#share-options {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#share-options.hidden {
    display: none;
}

.share-options-content {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    position: relative;
}

#share-options.hidden .share-options-content {
    transform: translateY(-20px);
}

.share-options-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 1.25rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-option:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.share-option:active {
    transform: translateY(0);
}

.share-option .icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.share-option .text {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.share-option .description {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}

#share-link-output {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#share-link-output.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#generated-link {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: monospace;
}

#generated-link:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

#password-input {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#password-input.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#share-password-input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.9rem;
}

#share-password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

#copy-link, #generate-password-link {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

#copy-link:hover, #generate-password-link:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#copy-link:active, #generate-password-link:active {
    transform: translateY(0);
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 2.5rem;
    height: 2.5rem;
    z-index: 1001;
}

.close-button:hover {
    background-color: var(--hover-color);
    transform: rotate(90deg);
}

.close-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Dark Mode */
body.dark-mode {
    background: #1a1a1a;
    color: #fff;
}

body.dark-mode header,
body.dark-mode #toolbar,
body.dark-mode #statusbar {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode #toolbar button {
    background: #404040;
    border-color: #505050;
    color: #fff;
}

body.dark-mode #toolbar button:hover {
    background: #505050;
}

/* Formatierungsstile */
#editor h1 { font-size: 2em; margin: 0.67em 0; }
#editor h2 { font-size: 1.5em; margin: 0.83em 0; }
#editor h3 { font-size: 1.17em; margin: 1em 0; }
#editor p { margin: 1em 0; }
#editor ul, #editor ol { margin: 1em 0; padding-left: 40px; }

/* Font Family Dropdown */
#font-family {
    min-width: 150px;
}

/* Table Styles */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

td, th {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    min-width: 50px;
}

th {
    background-color: var(--toolbar-bg);
}

.footer {
    text-align: center;
    padding: 20px;
    background: var(--bg-color);
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#modal-container.hidden {
    display: none;
}

.modal-content {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-title {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.modal-body {
    margin-bottom: 1.5rem;
}

#modal-message {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-color);
}

#modal-input-container {
    margin-bottom: 1rem;
}

#modal-input {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.9rem;
}

#modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

#modal-ok-button,
#modal-cancel-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#modal-ok-button {
    background-color: var(--primary-color);
    color: white;
}

#modal-cancel-button {
    background-color: var(--border-color);
    color: var(--text-color);
}

#modal-ok-button:hover,
#modal-cancel-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#modal-ok-button:active,
#modal-cancel-button:active {
    transform: translateY(0);
}

.error-message {
    color: #dc2626;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/* Modal Styles */
.bg-gray-800 {
    background-color: #1f2937;
}

.text-white {
    color: #ffffff;
}

.p-6 {
    padding: 1.5rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.max-w-sm {
    max-width: 24rem;
}

.w-full {
    width: 100%;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.justify-center {
    justify-content: center;
}

.space-x-4 > * + * {
    margin-left: 1rem;
}

.bg-blue-600 {
    background-color: #2563eb;
}

.hover\:bg-blue-700:hover {
    background-color: #1d4ed8;
}

.bg-gray-600 {
    background-color: #4b5563;
}

.hover\:bg-gray-700:hover {
    background-color: #374151;
}

.font-bold {
    font-weight: 700;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.rounded-md {
    border-radius: 0.375rem;
}

.focus\:outline-none:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.focus\:ring-2:focus {
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.focus\:ring-blue-500:focus {
    --tw-ring-color: #3b82f6;
}

.focus\:ring-gray-500:focus {
    --tw-ring-color: #6b7280;
}

.focus\:ring-offset-2:focus {
    --tw-ring-offset-width: 2px;
}

#share {
    font-size: 1.2rem !important;
    padding: 8px 16px !important;
    background-color: var(--accent-color) !important;
    color: white !important;
    border-radius: 6px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 120px !important;
    justify-content: center !important;
}

#share::before {
    content: "🔗" !important;
}

#share::after {
    content: "Share" !important;
}

#share:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
    background-color: var(--accent-color-hover) !important;
}

#share:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
} 