/* Grundlegendes Reset & Variablen */
:root {
    --bg: #121212;
    --surface: #1e1e1e;
    --surface-2: #2d2d2d;
    --text: #e0e0e0;
    --text-muted: #9e9e9e;
    --primary: #4f8cff;
    --primary-hover: #3a7aee;
    --danger: #ff5252;
    --danger-hover: #e04848;
    --border: #333;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Typografie */
h1, h2, h3 {
    margin-top: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background-color: var(--primary);
    color: #fff;
}

.btn.primary:hover {
    background-color: var(--primary-hover);
}

.btn.secondary {
    background-color: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background-color: #3a3a3a;
}

.btn.ghost {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn.ghost:hover {
    background-color: var(--surface-2);
    color: var(--text);
}

.btn.danger {
    background-color: var(--danger);
    color: #fff;
}

.btn.danger:hover {
    background-color: var(--danger-hover);
}

.btn.small {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

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

/* Formulare */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.hint.success {
    color: #4caf50;
}

/* Alerts */
.alert {
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert.error {
    background-color: rgba(255, 82, 82, 0.15);
    color: #ff8a8a;
    border: 1px solid rgba(255, 82, 82, 0.3);
}

.alert.success {
    background-color: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* Auth Container */
.auth-container {
    max-width: 420px;
    margin: 6rem auto;
    padding: 2rem;
    background-color: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-container h1 {
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* App Header */
.app-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.app-header h1 {
    font-size: 1.4rem;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-muted);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* App Main */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Editor */
.editor {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.note-title-input {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.note-content-input {
    min-height: 140px;
    margin-bottom: 1rem;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.color-btn:hover,
.color-btn.active {
    transform: scale(1.1);
    border-color: var(--text);
}

.editor-buttons {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

/* Notizen Grid */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.note-card {
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 180px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.note-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.note-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    word-break: break-word;
}

.note-body {
    flex: 1;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    word-break: break-word;
    white-space: pre-wrap;
}

.note-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.note-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.note-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Responsive */
@media (max-width: 640px) {
    html {
        font-size: 15px;
    }

    .auth-container {
        margin: 2rem 1rem;
        padding: 1.5rem;
    }

    .app-header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .app-header h1 {
        font-size: 1.15rem;
    }

    .user-name {
        max-width: 120px;
    }

    .app-main {
        padding: 1rem;
    }

    .editor-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .editor-buttons {
        width: 100%;
        margin-left: 0;
    }

    .editor-buttons .btn {
        flex: 1;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    .note-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .note-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
