:root {
    --primary: #0057b8;
    --primary-dark: #003d7a;
    --secondary: #f2f6fc;
    --text: #333;
    --text-light: #666;
    --border: #e0e6ed;
    --success: #28a745;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--secondary);
    color: var(--text);
    line-height: 1.6;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 460px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 48px 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.logo-section h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

.logo-section p {
    color: var(--text-light);
    font-size: 14px;
}

.features {
    margin: 24px 0;
}

.feature-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-icon {
    width: 24px;
    height: 24px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-right: 12px;
    flex-shrink: 0;
}

.feature-text {
    color: var(--text);
    font-size: 14px;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
    margin-top: 24px;
}

.btn-login:hover {
    background: var(--primary-dark);
}

.security-note {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
}

.page-selection-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.selection-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow);
}

.selection-box h2 {
    color: var(--primary);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 24px;
    font-size: 14px;
}

.page-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.page-option:hover {
    border-color: var(--primary);
    background: var(--secondary);
}

.page-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.page-option input[type="radio"]:checked + .page-info {
    color: var(--primary);
}

.page-option input[type="radio"]:checked ~ .checkmark {
    background: var(--primary);
}

.page-option input[type="radio"]:checked ~ .checkmark:after {
    display: block;
}

.page-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 32px;
}

.page-name {
    font-weight: 600;
    font-size: 16px;
}

.page-id {
    font-size: 12px;
    color: var(--text-light);
}

.checkmark {
    position: absolute;
    left: 16px;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid var(--border);
    border-radius: 50%;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.btn-connect {
    margin-top: 16px;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-connect:hover {
    background: var(--primary-dark);
}

.chat-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.chat-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 360px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 18px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

.search-box {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.search-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.conv-list {
    flex: 1;
    overflow-y: auto;
}

.conv {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.conv:hover, .conv.active {
    background: var(--secondary);
}

.conv strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
}

.conv small {
    color: var(--text-light);
    font-size: 13px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
}

.chat-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.chat-header h3 {
    color: var(--primary);
    font-size: 18px;
}

.msg-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.msg {
    margin-bottom: 12px;
    display: flex;
}

.msg.page {
    justify-content: flex-end;
}

.msg.user {
    justify-content: flex-start;
}

.msg > div {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: var(--radius);
    word-wrap: break-word;
}

.msg.page > div {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg.user > div {
    background: white;
    color: var(--text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.msg img {
    max-width: 100%;
    border-radius: 4px;
    margin-top: 8px;
}

.msg a {
    color: inherit;
    text-decoration: underline;
}

.input-area {
    background: white;
    border-top: 1px solid var(--border);
    padding: 16px;
}

.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.btn-attachment {
    padding: 12px 16px;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-attachment:hover {
    background: var(--border);
}

.btn-send {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-send:hover {
    background: var(--primary-dark);
}

.action-row {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.loading {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
        height: 100vh;
    }
    
    .chat-area {
        display: none;
    }
    
    .chat-area.active {
        display: flex;
    }
}
