:root {
    --primary: #8f7080;
    --primary-dark: #6b5563;
    --bg: #f5f3f4;
    --card: #ffffff;
    --text: #333;
    --text-light: #888;
    --border: #e0dcd9;
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.login-icon i { font-size: 2rem; color: white; }
.login-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.login-card p { color: var(--text-light); margin-bottom: 2rem; }

.form-group { margin-bottom: 1.5rem; }
.form-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-full { width: 100%; justify-content: center; }

.error-text { color: var(--danger); margin-top: 1rem; font-size: 0.9rem; }

.dashboard { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h2 { font-size: 1.5rem; color: var(--primary-dark); }
.header-right { display: flex; gap: 0.75rem; }

.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border);
    background: var(--card);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--primary); }
.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-value { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: 0.8rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }

.messages-list { display: flex; flex-direction: column; gap: 0.75rem; }

.message-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    border-left: 4px solid var(--primary);
}
.message-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.message-card.unread { border-left-color: var(--info); background: #f0f7ff; }

.message-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.message-icon.contact { background: #e0f2fe; color: #0284c7; }
.message-icon.register { background: #fef3c7; color: #d97706; }
.message-icon.training { background: #d1fae5; color: #059669; }

.message-info { flex: 1; min-width: 0; }
.message-title { font-weight: 600; margin-bottom: 0.25rem; }
.message-preview { color: var(--text-light); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-meta { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-light); }
.message-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-contact { background: #e0f2fe; color: #0284c7; }
.badge-register { background: #fef3c7; color: #d97706; }
.badge-training { background: #d1fae5; color: #059669; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-bottom: 2rem;
}
#page-info { font-size: 0.9rem; color: var(--text-light); }

.loading { text-align: center; padding: 3rem; color: var(--text-light); }
.no-messages { text-align: center; padding: 3rem; color: var(--text-light); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}
.modal-close:hover { color: var(--text); }

.modal-field { margin-bottom: 1rem; }
.modal-field label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.85rem; color: var(--text-light); }
.modal-field .value { font-size: 1rem; word-break: break-word; }

.mark-read-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--success);
    color: white;
}
.mark-read-btn:hover { background: #059669; }

@media (max-width: 640px) {
    .dashboard { padding: 1rem; }
    .dashboard-header h2 { font-size: 1.2rem; }
    .stats-bar { grid-template-columns: repeat(3, 1fr); }
    .message-card { flex-direction: column; gap: 0.5rem; }
    .message-icon { width: 36px; height: 36px; font-size: 0.9rem; }
}
