* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #333;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    color: #666;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
}

/* Dashboard */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #eee;
    padding: 1rem;
    overflow-y: auto;
}

.content-area {
    flex: 1;
    padding: 2rem;
    background: #f8f9fa;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.alert.success {
    background: #c6f6d5;
    color: #2d7d32;
    border: 1px solid #9ae6b4;
}

/* Conversation List */
.conversation-list {
    margin-top: 1rem;
}

.conversation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.conversation-item:hover {
    background: #f7fafc;
}

.conv-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #2d3748;
}

.last-message {
    color: #718096;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.time {
    font-size: 0.75rem;
    color: #a0aec0;
}

.unread-badge {
    background: #667eea;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    background: white;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: #e5ddd5;
}

.chat-input {
    background: white;
    padding: 1rem;
    border-top: 1px solid #eee;
}

.message-form {
    display: flex;
    gap: 0.5rem;
}

.message-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 1rem;
}

.message-form button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 20px;
    background: #667eea;
    color: white;
    cursor: pointer;
}

.message {
    display: flex;
    margin-bottom: 1rem;
    max-width: 70%;
}

.message.outgoing {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-content {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

.message.outgoing .message-content {
    background: #dcf8c6;
}

.message.traccar .message-content {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.traccar-alert {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #856404;
}

.message-text {
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    text-align: right;
}

.sender-name {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Groups */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.group-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.group-card h3 {
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.group-address {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.group-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-badge {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    margin-top: 2rem;
    color: #666;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.no-conversations,
.no-messages {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .user-info {
        justify-content: center;
    }
    
    .message {
        max-width: 85%;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
}

/* Notification specific styles */
.notification-item {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.notification-badge {
    background: #6c757d;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 1rem;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin: 0.5rem 0 0 0;
}

/* Admin styles */
.section-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-inline {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* Table styles */
.users-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.users-table th,
.users-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.users-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.admin-badge {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Message items */
.message-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.message-preview {
    margin: 0.5rem 0;
    color: #555;
}

/* Quick actions */
.quick-actions-section {
    margin: 2rem 0;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}