/* ---------- General ---------- */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #f5f5f5;
    color: #222;
    font-family: Arial, Helvetica, sans-serif;
}

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


/* ---------- Header ---------- */

.site-header {
    background-color: white;
    border-bottom: 1px solid #ddd;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 14px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-title {
    color: #222;
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
}

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

.username {
    margin-right: 5px;
    color: #666;
    font-size: 13px;
}


/* ---------- Header buttons ---------- */

.header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 34px;
    padding: 6px 12px;

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

    font-size: 13px;
    font-weight: 600;
    text-decoration: none;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.primary-button {
    border-color: #ff4500;
    background-color: #ff4500;
    color: white;
}

.primary-button:hover {
    border-color: #e03d00;
    background-color: #e03d00;
    color: white;
}

.secondary-button {
    border-color: #d7d7d7;
    background-color: #f5f5f5;
    color: #555;
}

.secondary-button:hover {
    border-color: #bbb;
    background-color: #e9e9e9;
    color: #222;
}

.logout-form {
    margin: 0;
}


/* ---------- Other buttons ---------- */

.create-button,
.back-button {
    display: inline-block;
    padding: 8px 14px;

    border-radius: 6px;

    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.create-button {
    background-color: #ff4500;
    color: white;
}

.create-button:hover {
    background-color: #e03d00;
}

.back-button {
    border: 1px solid #d7d7d7;
    background-color: #f5f5f5;
    color: #555;
}

.back-button:hover {
    background-color: #e9e9e9;
    color: #222;
}


/* ---------- Main content ---------- */

.main-content {
    width: 100%;
    max-width: 900px;

    margin: 30px auto;
    padding: 0 20px;
}

.main-content > h1 {
    margin-bottom: 20px;
    font-size: 24px;
}


/* ---------- Post ---------- */

.post-card {
    margin-bottom: 18px;
    padding: 20px;

    border: 1px solid #ddd;
    border-radius: 7px;

    background-color: white;
}

.post-header h2 {
    margin: 0 0 6px;
    font-size: 21px;
}

.post-meta {
    margin: 0;
    color: #777;
    font-size: 13px;
}

.post-content {
    margin-top: 18px;

    line-height: 1.5;
    white-space: pre-wrap;
}

.post-content p {
    margin: 0;
}


/* ---------- Post image ---------- */

.post-image {
    margin-top: 18px;
}

.post-image img {
    display: block;

    max-width: 100%;
    max-height: 600px;

    border-radius: 5px;
}


/* ---------- Voting ---------- */

.vote-section {
    display: flex;
    align-items: center;
    gap: 7px;

    margin-top: 16px;
    padding-top: 12px;

    border-top: 1px solid #eee;

    color: #777;
    font-size: 13px;
}

.vote-count {
    min-width: 22px;

    color: #333;
    font-weight: 700;
    text-align: center;
}

.vote-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 30px;
    padding: 0;

    border: 1px solid #d6d6d6;
    border-radius: 6px;

    background-color: #f7f7f7;
    color: #666;

    cursor: pointer;
    font-size: 14px;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.vote-button:hover {
    background-color: #eee;
}

.vote-button[data-direction="upvote"]:hover {
    border-color: #ff4500;
    background-color: #fff2ed;
    color: #ff4500;
}

.vote-button[data-direction="downvote"]:hover {
    border-color: #777;
    background-color: #eee;
    color: #333;
}

.privacy-button {
    margin-left: auto;
    padding: 6px 10px;

    border: 1px solid #d6d6d6;
    border-radius: 6px;

    background-color: #f5f5f5;
    color: #555;

    cursor: pointer;

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

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.privacy-button:hover {
    border-color: #bbb;
    background-color: #e9e9e9;
    color: #222;
}

.login-required {
    padding: 4px 8px;

    border-radius: 5px;

    background-color: #f1f1f1;
    color: #777;

    font-size: 12px;
}


/* ---------- Empty posts ---------- */

.empty-message {
    padding: 30px;

    border: 1px solid #ddd;
    border-radius: 7px;

    background-color: white;

    text-align: center;
}

.empty-message a {
    color: #ff4500;
}


/* ---------- Forms ---------- */

.form-card {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 25px;

    border: 1px solid #ddd;
    border-radius: 7px;

    background-color: white;
}

.form-card h1 {
    margin-top: 0;
    margin-bottom: 25px;

    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-size: 14px;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;

    border: 1px solid #ccc;
    border-radius: 5px;

    background-color: white;

    font-size: 15px;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff4500;
}


/* ---------- Anonymous option ---------- */

.anonymous-option {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 30px;
}

.anonymous-option input[type="checkbox"] {
    width: 16px !important;
    height: 16px;
    margin: 0 !important;
    padding: 0;

    flex: 0 0 auto;
}

.anonymous-option label {
    display: inline;

    width: auto;
    margin: 0;
}


/* ---------- Form submit ---------- */

.submit-button,
.form-submit-button {
    width: 100%;
    padding: 10px 16px;

    border: 1px solid #ff4500;
    border-radius: 6px;

    background-color: #ff4500;
    color: white;

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

    cursor: pointer;

    transition: background-color 0.15s ease;
}

.submit-button:hover,
.form-submit-button:hover {
    border-color: #e03d00;
    background-color: #e03d00;
}


/* ---------- Error modal ---------- */

.modal {
    display: none;

    position: fixed;
    z-index: 999;

    inset: 0;

    width: 100%;
    height: 100%;

    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;

    width: 90%;
    max-width: 400px;

    margin: 15vh auto;
    padding: 25px;

    border-radius: 7px;

    background-color: white;

    text-align: center;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-close {
    position: absolute;

    top: 10px;
    right: 12px;

    border: none;
    background: none;

    color: #777;

    cursor: pointer;
    font-size: 24px;
}

.modal-close:hover {
    color: #222;
}

.close-button {
    margin-top: 15px;
    padding: 8px 15px;

    border: none;
    border-radius: 5px;

    background-color: #d33;
    color: white;

    cursor: pointer;
}

.close-button:hover {
    background-color: #b22;
}


/* ---------- Mobile ---------- */

@media (max-width: 600px) {
    .header-content {
        padding: 12px 15px;

        align-items: flex-start;
        gap: 12px;
    }

    .site-title {
        font-size: 19px;
    }

    .header-actions {
        justify-content: flex-end;
        flex-wrap: wrap;

        gap: 6px;
    }

    .header-button {
        min-height: 32px;
        padding: 5px 9px;

        font-size: 12px;
    }

    .username {
        width: 100%;
        margin-right: 0;

        text-align: right;
    }

    .main-content {
        margin-top: 20px;
        padding: 0 10px;
    }

    .post-card {
        padding: 15px;
    }

    .vote-section {
        flex-wrap: wrap;
    }

    .vote-button {
        width: 32px;
    }

    .privacy-button {
        margin-left: 0;
    }

    .form-card {
        padding: 18px;
    }
}

/* ---------- Header actions ---------- */

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

.username {
    margin-right: 4px;
    color: #444;
    font-size: 14px;
}

.header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 36px;
    padding: 0 14px;

    border-radius: 6px;

    font-size: 14px;
    font-weight: normal;
    text-decoration: none;

    cursor: pointer;
}

/* Grey buttons */
.secondary-button {
    border: 1px solid #ddd;
    background-color: #eee;
    color: #333;
}

.secondary-button:hover {
    background-color: #ddd;
    color: #222;
}

/* Orange Create Post / Register button */
.primary-button {
    border: 1px solid #ff4500;
    background-color: #ff4500;
    color: white;
}

.primary-button:hover {
    background-color: #e03d00;
    color: white;
}

.logout-form {
    margin: 0;
}

.logout-form button {
    font-family: inherit;
}