* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f4f5f7;
    color: #202124;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: min(100% - 28px, 720px);
    margin: 0 auto;
}

/* Header */

.app-header {
    padding:
        calc(18px + env(safe-area-inset-top))
        0
        15px;
    background: #ffffff;
    border-bottom: 1px solid #e6e6e6;
}

.header-content h1 {
    margin: 0;
    font-size: 23px;
    line-height: 1.2;
}

.header-content p {
    margin: 5px 0 0;
    color: #777;
    font-size: 14px;
}

/* Suche */

.search-section {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px 0;
    background: #f4f5f7;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
}

#search {
    width: 100%;
    height: 50px;
    padding: 0 45px 0 43px;
    border: 1px solid #d8d8d8;
    border-radius: 14px;
    background: #ffffff;
    color: #202124;
    font-size: 17px;
    outline: none;
    box-shadow: 0 1px 3px rgb(0 0 0 / 4%);
}

#search:focus {
    border-color: #888;
}

.clear-search {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #777;
    font-size: 25px;
    cursor: pointer;
}

/* Vokabelkarten */

.vocabulary-list {
    display: grid;
    gap: 11px;
    padding-bottom:
        calc(100px + env(safe-area-inset-bottom));
}

.vocabulary-card {
    overflow: hidden;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 1px 4px rgb(0 0 0 / 8%);
}

.card-content {
    display: block;
    width: 100%;
    padding: 16px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.word-main,
.word-english,
.word-phonetic,
.word-thai,
.word-notes {
    display: block;
}

.word-main {
    font-size: 19px;
    font-weight: 700;
}

.word-english {
    margin-top: 3px;
    color: #777;
    font-size: 14px;
}

.word-phonetic {
    margin-top: 11px;
    font-size: 21px;
    font-weight: 600;
}

.word-thai {
    margin-top: 4px;
    font-size: 26px;
    line-height: 1.35;
}

.word-notes {
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid #eeeeee;
    color: #666;
    font-size: 14px;
}

/* Floating Action Button */

.fab {
    position: fixed;
    z-index: 30;
    right: 22px;
    bottom:
        calc(22px + env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
    padding: 0 0 4px;
    border: 0;
    border-radius: 50%;
    background: #202124;
    color: #ffffff;
    font-size: 36px;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 5px 16px rgb(0 0 0 / 25%);
    cursor: pointer;
}

/* Dialog */

dialog {
    width: min(92%, 520px);
    max-height: 90vh;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #ffffff;
    color: #202124;
    box-shadow: 0 15px 50px rgb(0 0 0 / 30%);
}

dialog::backdrop {
    background: rgb(0 0 0 / 45%);
    backdrop-filter: blur(2px);
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 10px;
}

.dialog-header h2 {
    margin: 0;
    font-size: 22px;
}

.dialog-header p {
    margin: 5px 0 0;
    color: #777;
    font-size: 13px;
}

.close-dialog {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    margin: -7px -7px 0 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #666;
    font-size: 28px;
    cursor: pointer;
}

#vocabularyForm {
    padding: 10px 20px 20px;
}

label {
    display: block;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.required {
    color: #b00020;
}

label input,
label textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 11px 12px;
    border: 1px solid #d5d5d5;
    border-radius: 10px;
    background: #ffffff;
    color: #202124;
    font-size: 16px;
    outline: none;
}

label input {
    min-height: 45px;
}

label textarea {
    resize: vertical;
}

label input:focus,
label textarea:focus {
    border-color: #777;
}

.save-button {
    width: 100%;
    min-height: 48px;
    margin-top: 3px;
    border: 0;
    border-radius: 11px;
    background: #202124;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Löschen */

.delete-form {
    padding: 0 20px 22px;
}

.delete-button {
    width: 100%;
    min-height: 46px;
    border: 1px solid #d43b3b;
    border-radius: 11px;
    background: #ffffff;
    color: #c62828;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* Status */

.empty-state,
.no-results {
    padding: 40px 20px;
    color: #777;
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-bottom: 7px;
    color: #444;
}

.empty-state span {
    display: block;
    font-size: 14px;
}

.error {
    margin: 5px 20px 10px;
    padding: 12px;
    border-radius: 9px;
    background: #ffeaea;
    color: #a00000;
    font-size: 14px;
}

.hidden {
    display: none;
}

@media (max-width: 500px) {
    dialog {
        width: calc(100% - 20px);
        max-height: 92vh;
    }

    .header-content h1 {
        font-size: 22px;
    }
}

/* Login */

.login-page {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding:
        calc(24px + env(safe-area-inset-top))
        20px
        calc(24px + env(safe-area-inset-bottom));
}

.login-container {
    width: min(100%, 420px);
}

.login-card {
    padding: 28px 22px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 5px 25px rgb(0 0 0 / 10%);
}

.login-icon {
    margin-bottom: 10px;
    font-size: 42px;
    text-align: center;
}

.login-card h1 {
    margin: 0;
    font-size: 24px;
    text-align: center;
}

.login-intro {
    margin: 7px 0 25px;
    color: #777;
    text-align: center;
}

.login-error {
    margin-bottom: 18px;
    padding: 12px;
    border-radius: 9px;
    background: #ffeaea;
    color: #a00000;
    font-size: 14px;
}
