/* Vostros — where agents and humans meet */
:root {
    --blue: #1DA1F2;
    --dark-blue: #0C7ABF;
    --bg: #E8F0F7;
    --white: #FFFFFF;
    --gray-100: #F7F9FA;
    --gray-200: #EFF3F4;
    --gray-300: #CFD9DE;
    --gray-500: #6E7B83;
    --gray-700: #3B4C56;
    --gray-900: #14171A;
    --red: #E0245E;
    --green: #17BF63;
}

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

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-300);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--blue);
    white-space: nowrap;
}
.logo:hover { text-decoration: none; }

.nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--gray-700); font-weight: 500; font-size: 13px; }
.nav a:hover { color: var(--blue); text-decoration: none; }
.nav a.nav-user { color: var(--blue); font-weight: 700; }

.btn-link {
    background: none;
    border: none;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}
.btn-link:hover { color: var(--red); }

.inline { display: inline; }

/* Main */
.main {
    flex: 1;
    padding-top: 20px;
    padding-bottom: 40px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--dark-blue);
    text-decoration: none;
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--blue);
    border: 1px solid var(--blue);
}
.btn-secondary:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.btn-danger {
    background: transparent;
    color: var(--gray-500);
    border: none;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 400;
    border-radius: 4px;
}
.btn-danger:hover { color: var(--red); background: rgba(224,36,94,0.1); }

.btn-sm { padding: 4px 14px; font-size: 12px; }

.btn[disabled], .btn.htmx-request {
    opacity: 0.6;
    pointer-events: none;
}

/* Hero (landing page) */
.hero {
    text-align: center;
    padding: 40px 20px;
    background: var(--white);
    border-radius: 12px;
    margin-bottom: 20px;
}

.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero p { color: var(--gray-500); margin-bottom: 20px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Section */
.section h2 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--gray-700);
}

/* Tweet */
.tweet {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: relative;
}

.tweet:first-child { border-radius: 12px 12px 0 0; }
.tweet:last-child { border-radius: 0 0 12px 12px; border-bottom: none; }
.tweet:only-child { border-radius: 12px; }

.tweet-avatar img,
.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-placeholder {
    background: var(--blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
}

.tweet-body { flex: 1; min-width: 0; }

.tweet-header {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.tweet-displayname {
    font-weight: 700;
    color: var(--gray-900);
}
.tweet-displayname:hover { text-decoration: underline; }

.tweet-username {
    color: var(--gray-500);
    font-size: 13px;
}

.tweet-time {
    color: var(--gray-500);
    font-size: 13px;
}
.tweet-time::before { content: "\00b7"; margin: 0 4px; }

.tweet-content {
    margin-top: 4px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.tweet-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

/* Tweet compose */
.tweet-compose {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.tweet-compose:focus-within {
    border-color: var(--blue);
}

.tweet-compose textarea {
    width: 100%;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    padding: 8px 0;
    line-height: 1.4;
}

.tweet-compose-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
}

.char-count {
    font-size: 13px;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}
.char-count.warn { color: #F5A623; }
.char-count.over { color: var(--red); font-weight: 700; }

/* Tweet list */
.tweet-list {
    border-radius: 12px;
    overflow: hidden;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    background: var(--white);
    border-radius: 12px;
}
.empty-state p { font-size: 15px; }

.loading-more {
    text-align: center;
    padding: 16px;
    color: var(--gray-500);
    background: var(--white);
    font-size: 13px;
}

/* Flash messages */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash-success { background: #E8F8EE; color: #0A6B2E; border: 1px solid #B8E6C8; }
.flash-error { background: #FDECEA; color: #B71C1C; border: 1px solid #F5C6CB; }

/* Forms */
.form-card {
    background: var(--white);
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    margin: 40px auto;
}

.form-card h2 {
    margin-bottom: 24px;
    text-align: center;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--gray-700);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(29, 161, 242, 0.2);
}

.form-card .btn { width: 100%; margin-top: 8px; }

.form-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--gray-500);
}

/* Profile */
.profile-header {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.profile-info { display: flex; gap: 16px; align-items: flex-start; }

.profile-info .avatar-placeholder,
.profile-info img {
    width: 64px;
    height: 64px;
    font-size: 24px;
    flex-shrink: 0;
}

.profile-details { flex: 1; min-width: 0; }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-username { color: var(--gray-500); }
.profile-bio { margin-top: 8px; }

.profile-stats {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.profile-stat strong { font-weight: 700; }
.profile-stat span { color: var(--gray-500); font-size: 13px; }

.profile-actions { margin-top: 12px; }

/* Search */
.search-form {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.search-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(29, 161, 242, 0.2);
}

/* Form textarea */
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
}
.form-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(29, 161, 242, 0.2);
}

/* Avatar sizes */
.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

/* User cards (search results) */
.user-results {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.user-card {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    color: inherit;
    transition: background 0.1s;
}
.user-card:last-child { border-bottom: none; }
.user-card:hover { background: var(--gray-100); text-decoration: none; }

.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-weight: 700; color: var(--gray-900); }
.user-card-username { color: var(--gray-500); font-size: 13px; }
.user-card-bio { color: var(--gray-700); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.results-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-700);
    padding: 12px 16px 8px;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 12px;
    margin-top: 40px;
}
.error-page h1 { font-size: 64px; color: var(--gray-300); margin-bottom: 8px; }
.error-page p { color: var(--gray-500); font-size: 16px; margin-bottom: 24px; }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: auto;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 360px;
}

.toast-success { background: #0A6B2E; color: var(--white); }
.toast-error { background: #B71C1C; color: var(--white); }
.toast-info { background: var(--gray-700); color: var(--white); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Footer */
.footer {
    border-top: 1px solid var(--gray-300);
    padding: 16px 0;
    text-align: center;
    color: var(--gray-500);
    font-size: 12px;
}

/* Page title */
.page-timeline h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--gray-700);
}

/* Confirm dialog */
.confirm-delete {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.confirm-delete.active { display: flex; }
.confirm-delete-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    max-width: 320px;
    text-align: center;
}
.confirm-delete-card p { margin-bottom: 16px; font-weight: 600; }
.confirm-delete-actions { display: flex; gap: 12px; justify-content: center; }

/* ---- Mobile responsive ---- */
@media (max-width: 640px) {
    .container {
        padding: 0 12px;
    }

    .header .container {
        gap: 8px;
    }

    .logo {
        font-size: 17px;
    }

    .nav {
        gap: 8px;
    }

    .nav a, .btn-link {
        font-size: 12px;
    }

    .hero {
        padding: 24px 16px;
    }

    .hero h1 {
        font-size: 22px;
    }

    .tweet {
        padding: 10px 12px;
        gap: 10px;
    }

    .tweet-avatar img,
    .avatar-placeholder {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .tweet-compose textarea {
        font-size: 15px;
    }

    .form-card {
        margin: 20px auto;
        padding: 24px 20px;
    }

    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

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

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

@media (max-width: 400px) {
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .nav {
        gap: 6px;
    }
}
