/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
}

.login-box h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-install {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn-install:active {
    transform: translateY(0);
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4CAF50;
}

.alert-warning {
    background: #fff3e0;
    color: #ef6c00;
    border-left: 4px solid #ff9800;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: white;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-size: 14px;
    display: none;
}

/* Chat Layout */
.chat-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Users Sidebar */
.users-sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
    font-size: 18px;
    color: #333;
}

.users-list {
    flex: 1;
    overflow-y: auto;
}

.user-item {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
    position: relative;
}

.user-item:hover {
    background: #f8f9fa;
}

.user-item.active {
    background: #e8f5e9;
    border-left: 3px solid #4CAF50;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Status Indicator (green/gray dot) */
.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.status-indicator.online {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #9e9e9e;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Status Text */
.status-text {
    font-size: 12px;
    font-weight: 500;
}

.status-text.online {
    color: #4CAF50;
}

.status-text.offline {
    color: #9e9e9e;
}

/* Status Badge for Admin Panel */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.online {
    background: #e8f5e9;
    color: #4CAF50;
}

.status-badge.offline {
    background: #f5f5f5;
    color: #9e9e9e;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.user-status {
    font-size: 13px;
    color: #666;
}

.unread-badge {
    background: #4CAF50;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.no-users {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

.chat-empty p {
    margin-top: 20px;
    font-size: 16px;
}

.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back-mobile {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.chat-user-name {
    font-weight: 600;
    color: #333;
}

.chat-user-status {
    font-size: 12px;
    color: #666;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 70%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.received {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 15px;
    border-radius: 15px;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.received .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-text {
    margin-bottom: 5px;
}

.message-image, .message-video {
    max-width: 100%;
    border-radius: 10px;
    margin-bottom: 5px;
}

.message-image img {
    max-width: 100%;
    border-radius: 10px;
    display: block;
}

.message-video video {
    max-width: 100%;
    border-radius: 10px;
    display: block;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

/* Chat Input */
.chat-input-container {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-container form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-attach {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-attach:hover {
    background: #f5f5f5;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
}

#messageInput:focus {
    border-color: #4CAF50;
}

.btn-send {
    background: #4CAF50;
    border: none;
    color: white;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-send:hover {
    background: #45a049;
}

.file-preview {
    margin-top: 10px;
    position: relative;
}

.file-preview img, .file-preview video {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    border: 2px solid #4CAF50;
}

.btn-remove-file {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #f44336;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

/* Admin Styles */
.admin-container {
    display: flex;
    height: 100vh;
    background: #f5f5f5;
}

.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    display: flex;
    flex-direction: column;
}

.admin-logo {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-logo img {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    margin-bottom: 15px;
}

.admin-logo h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.admin-badge {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
}

.admin-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-item.active {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4CAF50;
    color: white;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 24px;
    color: #333;
}

.admin-user {
    color: #666;
    font-size: 14px;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info h3 {
    font-size: 32px;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 14px;
}

/* Quick Actions */
.quick-actions {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.quick-actions h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Users Table */
.users-table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    color: #666;
    font-size: 14px;
}

.users-table tr:hover {
    background: #f8f9fa;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #e8f5e9;
    color: #4CAF50;
}

.badge-danger {
    background: #ffebee;
    color: #f44336;
}

.action-buttons-inline {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f5f5f5;
    border-color: #999;
}

.btn-icon.btn-danger {
    border-color: #f44336;
    color: #f44336;
}

.btn-icon.btn-danger:hover {
    background: #ffebee;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-content form {
    padding: 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .user-name {
        display: none;
    }
    
    .users-sidebar {
        width: 100%;
        position: absolute;
        z-index: 100;
        height: calc(100vh - 70px);
        transition: transform 0.3s;
    }
    
    .users-sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .chat-main {
        width: 100%;
    }
    
    .chat-active {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fafafa;
        z-index: 101;
    }
    
    .btn-back-mobile {
        display: block;
    }
    
    .message {
        max-width: 85%;
    }
    
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .users-table-container {
        overflow-x: auto;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .btn-install {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn-install svg {
        width: 16px;
        height: 16px;
    }
}

/* Settings Page */
.settings-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    overflow: hidden;
}

.settings-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.settings-header h2 {
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-header svg {
    color: #4CAF50;
}

.settings-body {
    padding: 25px;
}

.logo-preview {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.logo-preview h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #555;
}

.logo-preview img {
    display: block;
    margin: 0 auto;
}

input[type="file"] {
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.3s;
}

input[type="file"]:hover {
    border-color: #4CAF50;
}

small {
    display: block;
    margin-top: 5px;
}

@media (max-width: 480px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}
