/* WhatsApp Dashboard Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    color: #333;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 80px;
}

.nav-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-brand i {
    margin-right: 0.5rem;
    font-size: 2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.2);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid white;
    border-radius: 5px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background-color: white;
    color: #25d366;
}

/* Main Content */
.main-content {
    padding: 2.5rem 4rem;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 160px);
    margin: 0;
}

/* Login Page */
.login-body {
    background: linear-gradient(135deg, #25d366, #128c7e);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 15px;
    padding: 4rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 4rem;
    color: #25d366;
    margin-bottom: 1rem;
}

.login-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group i {
    margin-right: 0.5rem;
    color: #25d366;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #25d366;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s;
}

.login-btn:hover {
    transform: translateY(-2px);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #c33;
}

.login-footer {
    padding: 2rem 0;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
}

.login-footer .footer-logo {
    height: 20px;
    width: auto;
}

.login-footer .footer-text {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0;
}

.login-footer .footer-link {
    color: #25d366;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.login-footer .footer-link:hover {
    color: #128c7e;
}

/* Dashboard */
.dashboard-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.dashboard-header {
    text-align: left;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.dashboard-header h1 {
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 2.8rem;
    font-weight: 600;
}

.dashboard-header p {
    color: #666;
    font-size: 1.2rem;
    font-weight: 400;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-bottom: 4rem;
    width: 100%;
    max-width: none;
}

.stat-card {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s;
    min-height: 120px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.stat-icon {
    font-size: 2.5rem;
    color: #25d366;
    margin-right: 1.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.stat-content p {
    color: #666;
    font-size: 0.9rem;
}

/* Messages Table */
.recent-messages {
    background: white;
    border-radius: 15px;
    padding: 3rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    width: 100%;
    min-width: 800px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    color: #333;
}

.view-all-btn {
    color: #25d366;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.view-all-btn:hover {
    color: #128c7e;
}

.messages-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.messages-table th,
.messages-table td {
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.messages-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.message-row {
    cursor: pointer;
    transition: background-color 0.3s;
}

.message-row:hover {
    background-color: #f8f9fa;
}

.contact-info {
    display: flex;
    align-items: center;
}

.contact-info i {
    margin-right: 0.5rem;
    color: #25d366;
}

.message-text {
    max-width: 600px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.instance-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.type-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.type-badge.text {
    background: #e8f5e8;
    color: #2e7d32;
}

.type-badge.image {
    background: #fff3e0;
    color: #f57c00;
}

.time-cell {
    font-size: 0.9rem;
    color: #666;
}

.no-data {
    text-align: center;
    color: #666;
    padding: 3rem;
}

/* Chats Page */
.chats-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.chats-header {
    text-align: left;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.chats-header h1 {
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 2.8rem;
    font-weight: 600;
}

.chats-header p {
    color: #666;
    font-size: 1.2rem;
    font-weight: 400;
}

.conversations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.conversation-card {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    min-height: 140px;
    margin-bottom: 0;
    width: 100%;
}

.conversation-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.conversation-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
}

.conversation-avatar i {
    color: white;
    font-size: 1.5rem;
}

.conversation-info {
    flex: 1;
    min-width: 0;
    padding-right: 1rem;
}

.conversation-info h3 {
    color: #333;
    margin-bottom: 0.25rem;
}

.phone-number {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.last-message {
    color: #888;
    font-size: 0.9rem;
}

.conversation-meta {
    text-align: right;
    flex-shrink: 0;
    min-width: 120px;
}

.message-count {
    background: #25d366;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.last-time {
    color: #666;
    font-size: 0.8rem;
}

.no-conversations {
    text-align: center;
    padding: 6rem 4rem;
    color: #666;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.no-conversations i {
    font-size: 5rem;
    margin-bottom: 2rem;
    color: #e5e7eb;
}

.no-conversations h3 {
    font-size: 1.8rem;
    color: #374151;
    margin-bottom: 1rem;
}

.no-conversations p {
    font-size: 1.1rem;
    color: #6b7280;
}

/* Chat Page */
.chat-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%;
    min-width: 800px;
}

.chat-header {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.back-btn {
    color: white;
    text-decoration: none;
    margin-right: 1rem;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.back-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
}

.chat-title {
    flex: 1;
}

.chat-title h1 {
    margin-bottom: 0.25rem;
}

.chat-title p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.chat-stats {
    font-size: 0.9rem;
}

.chat-messages {
    height: 600px;
    overflow-y: auto;
    padding: 2rem;
    background: #f8f9fa;
    margin-bottom: 3rem;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

.message {
    margin-bottom: 1rem;
    display: flex;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 1rem;
    border-radius: 15px;
    position: relative;
}

.message.sent .message-bubble {
    background: #25d366;
    color: white;
    border-bottom-right-radius: 5px;
}

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

.message-content {
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.message-meta {
    font-size: 0.8rem;
    opacity: 0.7;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.no-messages {
    text-align: center;
    padding: 4rem;
    color: #666;
}

.no-messages i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ddd;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.user-btn:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
}

.user-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s;
}

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

.user-menu-item.active {
    background-color: #e3f2fd;
    color: #1976d2;
}

.user-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.user-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Admin Styles */
.admin-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.admin-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
}

.admin-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.admin-actions {
    margin-bottom: 2rem;
    text-align: right;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-primary {
    background: #25d366;
    color: white;
}

.btn-primary:hover {
    background: #128c7e;
}

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

.btn-secondary:hover {
    background: #545b62;
}

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

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

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.users-table {
    background: white;
    border-radius: 15px;
    padding: 3rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    width: 100%;
    min-width: 800px;
}

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

.users-table th,
.users-table td {
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.users-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.role-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.role-badge.admin {
    background: #fff3e0;
    color: #f57c00;
}

.role-badge.user {
    background: #e8f5e8;
    color: #2e7d32;
}

.you-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #25d366;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.phone-numbers-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.phone-number-item {
    margin-bottom: 0.5rem;
}

.phone-number-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.phone-number-item label:hover {
    background-color: #f8f9fa;
}

.phone-number-item input[type="checkbox"] {
    width: auto;
}

/* Profile Styles */
.profile-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.profile-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
}

.profile-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.profile-card {
    background: white;
    border-radius: 15px;
    padding: 3rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%;
    min-width: 600px;
}

.profile-info {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.profile-info h3 {
    color: #333;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.info-row label {
    font-weight: 600;
    color: #666;
}

.profile-actions h3 {
    color: #333;
    margin-bottom: 1.5rem;
}

/* Professional Desktop Layout Enhancements */
@media (min-width: 1400px) {
    .main-content {
        padding: 3rem 6rem;
    }
    
    .conversations-list {
        grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
        gap: 3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 3rem;
    }
    
    .users-table, .recent-messages {
        min-width: 1000px;
    }
    
    .login-container {
        max-width: 700px;
    }
    
    .login-card {
        padding: 5rem;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        padding: 2rem;
    }
    
    .navbar {
        padding: 1.5rem 2rem;
    }
    
    .conversations-list {
        grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        min-height: auto;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .conversations-list {
        grid-template-columns: 1fr;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .conversation-card {
        flex-direction: column;
        text-align: center;
        min-height: auto;
    }
    
    .conversation-avatar {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
    
    .users-table, .recent-messages, .profile-card, .chat-container {
        min-width: auto;
        width: 100%;
    }
    
    .users-table table, .messages-table table {
        min-width: auto;
        font-size: 0.9rem;
    }
    
    .users-table th, .users-table td,
    .messages-table th, .messages-table td {
        padding: 0.75rem;
    }
}

/* Footer */
.footer {
    background: #f8f9fa;
    border-top: 1px solid #eee;
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-logo {
    height: 32px;
    width: auto;
}

.footer-text {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.footer-link {
    color: #25d366;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.footer-link:hover {
    color: #128c7e;
}

.login-body .footer {
    background: rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.2);
}

.login-body .footer-text {
    color: rgba(255,255,255,0.8);
}

.login-body .footer-link {
    color: white;
}

.login-body .footer-link:hover {
    color: rgba(255,255,255,0.8);
}

/* Instances Page Styling */
.instances-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.instances-header {
    text-align: left;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.instances-header h1 {
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 2.8rem;
    font-weight: 600;
}

.instances-header p {
    color: #666;
    font-size: 1.2rem;
    font-weight: 400;
}

.instances-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.instance-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: #666;
}

.instance-stats i {
    color: #25d366;
}

.instance-stats #totalInstances {
    font-weight: 600;
    color: #25d366;
}

/* Instances Grid Layout */
.instances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

/* Instance Card */
.instance-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e5e7eb;
    margin-bottom: 0;
    position: relative;
    overflow: visible;
}

.instance-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    border-color: #d1d5db;
}

.instance-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 15px 15px 0 0;
}

/* Instance Header */
.instance-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.instance-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.instance-icon i {
    color: white;
    font-size: 1.5rem;
}

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

.instance-info h3 {
    margin: 0 0 0.25rem 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
}

.instance-id {
    color: #6b7280;
    font-size: 0.75rem;
    margin: 0;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.instance-status {
    flex-shrink: 0;
    margin-left: 1rem;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge i {
    font-size: 0.5rem;
}

.status-badge.open {
    background: #dcfce7;
    color: #166534;
}

.status-badge.close {
    background: #fee2e2;
    color: #dc2626;
}

.status-badge.connecting {
    background: #fef3c7;
    color: #d97706;
}

/* Instance Details */
.instance-details {
    margin-bottom: 2rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.detail-row {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
    min-height: 40px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row label {
    display: flex;
    align-items: center;
    min-width: 140px;
    color: #374151;
    font-weight: 600;
    font-size: 0.875rem;
}

.detail-row label i {
    margin-right: 0.75rem;
    color: #25d366;
    width: 18px;
    text-align: center;
    font-size: 1rem;
}

.detail-value {
    color: #1f2937;
    font-weight: 500;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.detail-value.message-count {
    color: #25d366;
    font-weight: 600;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.alias-input {
    flex: 1;
    padding: 0.6rem 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    font-weight: 500;
}

.alias-input:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
    background: white;
}

.alias-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Instance Actions */
.instance-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.instance-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.instance-actions .btn i {
    margin-right: 0.5rem;
}

/* No Instances State */
.no-instances {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.no-instances i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

.no-instances h3 {
    color: #374151;
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.no-instances p {
    color: #6b7280;
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .footer {
        padding: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-logo {
        height: 28px;
    }
    
    .footer-text {
        font-size: 0.8rem;
    }

    .instances-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .controls-left {
        justify-content: center;
    }

    .controls-right {
        justify-content: center;
    }

    .instances-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .instance-card {
        padding: 1.5rem;
    }

    .instance-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .instance-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .instance-status {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        min-height: auto;
    }

    .detail-row label {
        min-width: auto;
        margin-bottom: 0.25rem;
    }

    .alias-input {
        width: 100%;
    }

    .instance-actions {
        flex-direction: column;
    }

    .instance-actions .btn {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .instance-card {
        padding: 1rem;
    }

    .no-instances {
        padding: 2rem 1rem;
    }
}