/* LINE Read Checker - Notion-inspired Light Theme */
:root {
    --bg: #ffffff;
    --bg-secondary: #fbfbfa;
    --bg-tertiary: #f1f1ef;
    --bg-hover: #ebebea;
    --text: #37352f;
    --text-secondary: #787774;
    --text-light: #b4b4b3;
    --accent: #2eaadc;
    --accent-bg: rgba(46, 170, 220, 0.1);
    --red: #eb5757;
    --red-bg: rgba(235, 87, 87, 0.1);
    --green: #4dab9a;
    --green-bg: rgba(77, 171, 154, 0.1);
    --yellow: #cb912f;
    --border: #e3e2de;
    --border-light: #f0efed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ─── Login Page ─── */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg-secondary);
}

.login-container {
    background: var(--bg);
    border-radius: 3px;
    padding: 48px 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-light);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.input::placeholder {
    color: var(--text-light);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s;
    line-height: 1.4;
}

.btn:hover {
    background: var(--bg-tertiary);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    width: 100%;
    font-weight: 600;
}

.btn-primary:hover {
    background: #2899c4;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.info {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.status-msg {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 13px;
    min-height: 20px;
}

.status-msg.success {
    background: var(--green-bg);
    color: var(--green);
}

.status-msg.error {
    background: var(--red-bg);
    color: var(--red);
}

.status-msg.info {
    background: var(--accent-bg);
    color: var(--accent);
}

.login-warning {
    margin-top: 24px;
    padding: 12px 16px;
    background: var(--red-bg);
    border-radius: 3px;
    font-size: 12px;
    color: var(--red);
    line-height: 1.6;
    text-align: center;
}

/* ─── Header ─── */
header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    height: 45px;
}

.header-content h1 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.badge-connected {
    background: var(--green-bg);
    color: var(--green);
}

.badge-disconnected {
    background: var(--red-bg);
    color: var(--red);
}

.badge-ws {
    background: var(--accent-bg);
    color: var(--accent);
}

/* ─── Main Layout ─── */
main {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 45px);
}

/* ─── Sidebar ─── */
#sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 12px 8px;
}

.sidebar-header h2 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.group-list {
    padding: 0 8px 8px;
}

.group-item {
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.1s;
    margin-bottom: 1px;
}

.group-item:hover {
    background: var(--bg-hover);
}

.group-item.active {
    background: var(--bg-hover);
}

.group-item .group-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-item.active .group-name {
    font-weight: 500;
}

.group-item .group-id {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Content ─── */
#content {
    flex: 1;
    padding: 32px 48px;
    overflow-y: auto;
    background: var(--bg);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: var(--text-light);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.hidden { display: none !important; }

/* ─── Group Detail ─── */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.group-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.group-actions {
    display: flex;
    gap: 8px;
}

.detail-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.dtab {
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    margin-right: 24px;
}

.dtab:hover {
    color: var(--text);
}

.dtab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.dtab-content { display: none; }
.dtab-content.active { display: block; }

/* ─── Read Log ─── */
.read-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.read-log-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.read-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.read-log {
    border-top: 1px solid var(--border);
    max-height: 70vh;
    overflow-y: auto;
}

.read-entry {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    animation: fadeIn 0.3s ease;
}

.read-entry:last-child {
    border-bottom: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.read-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-right: 12px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.read-info {
    flex: 1;
    min-width: 0;
}

.read-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.read-time {
    font-size: 11px;
    color: var(--text-light);
    flex-shrink: 0;
    margin-left: 12px;
}

.new-read {
    background: var(--green-bg);
}

.empty-reads {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* ─── Message List ─── */
.message-list {
    border-top: 1px solid var(--border);
    max-height: 70vh;
    overflow-y: auto;
}

.msg-entry {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.msg-entry:last-child {
    border-bottom: none;
}

.msg-sender {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.msg-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
}

.msg-meta {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-light);
}

.msg-read-btn {
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
}

.msg-read-btn:hover {
    text-decoration: underline;
}

/* ─── Member List ─── */
.member-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px;
}

.member-card {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 3px;
    transition: background 0.1s;
}

.member-card:hover {
    background: var(--bg-hover);
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-right: 10px;
    color: var(--text-secondary);
}

.member-name {
    font-size: 14px;
    color: var(--text);
}

/* ─── Loading ─── */
.loading {
    padding: 48px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

/* ─── Scrollbar (Notion-style thin) ─── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
    main { flex-direction: column; }

    #sidebar {
        width: 100%;
        min-width: unset;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .group-list {
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding: 4px 8px 8px;
    }

    .group-item {
        min-width: 150px;
        flex-shrink: 0;
    }

    .group-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-tabs {
        overflow-x: auto;
    }

    .member-list {
        grid-template-columns: 1fr;
    }

    #content {
        padding: 16px;
    }

    .group-header h2 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 13px;
    }

    .login-container {
        padding: 32px 24px;
    }

    #content {
        padding: 12px;
    }

    .group-header h2 {
        font-size: 18px;
    }

    .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}
