/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    height: 100vh;
    overflow: hidden;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    color: white;
    padding: 12px 16px;
    z-index: 1000;
    align-items: center;
    height: 56px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    margin-left: 15px;
}

.mobile-actions {
    display: flex;
    gap: 20px;
}

.mobile-actions i {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* Mobile Search */
.mobile-search {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-search input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.close-search {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 56px;
    right: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 200px;
}

.mobile-menu.active {
    display: block;
}

.menu-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: #333;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item i {
    color: #14b8a6;
    width: 20px;
}

.menu-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

/* Main Container */
.container {
    display: flex;
    height: 100vh;
    background: #ffffff;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 380px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    display: flex;
    gap: 20px;
}

.header-actions i {
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.header-actions i:hover {
    transform: scale(1.1);
}

.search-box {
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    background: #f0f2f5;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    background: #e9ebee;
}

/* Tabs */
.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #667781;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.tab-btn.active {
    color: #14b8a6;
    border-bottom-color: #14b8a6;
}

.unread-total {
    background: #f44336;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.tab-content.active {
    display: block;
}

/* Chat List */
.conversations-list {
    background: #fff;
}

.conversation-item {
    display: flex;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    position: relative;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.active {
    background: #e9f7f7;
}

.contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-right: 15px;
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.contact-name {
    font-weight: 600;
    font-size: 16px;
    color: #111;
    display: flex;
    align-items: center;
    gap: 6px;
}

.favorite-star {
    color: #ffb300;
    font-size: 14px;
}

.message-time {
    font-size: 12px;
    color: #667781;
}

.last-message {
    font-size: 14px;
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: #14b8a6;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    position: absolute;
    right: 16px;
    top: 16px;
}

/* Contacts & Calls Lists */
.contacts-container,
.calls-container {
    background: #fff;
}

.contact-item,
.call-item {
    display: flex;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.contact-item:hover,
.call-item:hover {
    background: #f8f9fa;
}

.call-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.call-type.incoming {
    color: #4caf50;
}

.call-type.outgoing {
    color: #2196f3;
}

.call-type.missed {
    color: #f44336;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #efeae2;
    position: relative;
}

.chat-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
}

.empty-state-content {
    text-align: center;
    color: #667781;
}

.empty-state-content i {
    font-size: 80px;
    margin-bottom: 20px;
    color: #14b8a6;
    opacity: 0.5;
}

.empty-state-content h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

.empty-state-content p {
    margin-bottom: 20px;
}

/* Chat Header */
.chat-header {
    background: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    display: none;
}

.chat-header.active {
    display: flex;
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.chat-contact-details h3 {
    font-size: 18px;
    color: #111;
    margin-bottom: 4px;
}

.chat-contact-details p {
    font-size: 13px;
    color: #667781;
}

.chat-actions {
    display: flex;
    gap: 25px;
}

.chat-actions i {
    font-size: 20px;
    color: #54656f;
    cursor: pointer;
    transition: color 0.2s;
}

.chat-actions i:hover {
    color: #14b8a6;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #efeae2;
    background-image: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="%23efeae2"/><path d="M0 0L100 100M100 0L0 100" stroke="%23e0ddd5" stroke-width="0.5" opacity="0.3"/></svg>');
    display: none;
}

.messages-container.active {
    display: block;
}

.message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.sent .message-bubble {
    background: #d9fdd3;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: #ffffff;
    border-bottom-left-radius: 4px;
}

.message-text {
    color: #111;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-image {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
}

.sms-indicator,
.mms-indicator {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
}

.sms-indicator {
    background: #ff9800;
    color: white;
}

.mms-indicator {
    background: #2196f3;
    color: white;
}

/* Message Input */
.message-input-area {
    background: #f0f2f5;
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    border-top: 1px solid #e0e0e0;
    display: none;
}

.message-input-area.active {
    display: flex;
}

.input-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.input-actions i {
    font-size: 24px;
    color: #54656f;
    cursor: pointer;
    transition: color 0.2s;
}

.input-actions i:hover {
    color: #14b8a6;
}

.message-input-wrapper {
    flex: 1;
    position: relative;
    background: white;
    border-radius: 25px;
    padding: 0 15px;
    display: flex;
    align-items: center;
}

.message-input {
    flex: 1;
    border: none;
    padding: 12px 0;
    font-size: 15px;
    outline: none;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
    background: transparent;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.4);
}

.character-counter {
    position: absolute;
    bottom: -20px;
    right: 10px;
    font-size: 11px;
    color: #667781;
}

.character-counter.warning {
    color: #ff9800;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    color: #111;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #667781;
    cursor: pointer;
    padding: 5px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #111;
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #14b8a6;
}

/* Contact Info */
.contact-info-header {
    text-align: center;
    margin-bottom: 30px;
}

.contact-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 36px;
    margin: 0 auto 15px;
}

.contact-info-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #111;
}

.contact-info-header p {
    color: #667781;
}

.contact-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.btn-action {
    padding: 12px 20px;
    background: #f0f2f5;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
}

.btn-action:hover {
    background: #e4e6e9;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-item i {
    font-size: 20px;
    color: #14b8a6;
    margin-top: 2px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: #667781;
    margin-bottom: 4px;
}

.detail-item p {
    font-size: 15px;
    color: #111;
}

/* About Modal */
.about-content {
    text-align: center;
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.app-icon i {
    font-size: 40px;
    color: white;
}

.about-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #111;
}

.about-content p {
    color: #667781;
    margin-bottom: 30px;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
    margin-top: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.feature-item i {
    color: #14b8a6;
}

/* Call Modals */
.call-modal {
    max-width: 400px;
}

.call-screen {
    padding: 40px 20px;
    text-align: center;
}

.caller-info {
    margin-bottom: 60px;
}

.caller-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 36px;
    margin: 0 auto 20px;
}

.caller-info h2 {
    font-size: 28px;
    color: white;
    margin-bottom: 8px;
}

.caller-info p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.call-status {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.call-duration {
    font-size: 20px;
    color: white;
    font-weight: 600;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.call-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.end-call {
    background: #f44336;
}

.end-call:hover {
    background: #d32f2f;
}

.accept-call {
    background: #4caf50;
}

.accept-call:hover {
    background: #388e3c;
}

.decline-call {
    background: #f44336;
}

.decline-call:hover {
    background: #d32f2f;
}

/* File Preview */
.preview-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #111;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d7377 0%, #14b8a6 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.4);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(20, 184, 166, 0.6);
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.3s;
    color: #667781;
    font-size: 12px;
}

.nav-btn.active {
    color: #14b8a6;
}

.nav-btn i {
    font-size: 20px;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        width: 100%;
        height: calc(100vh - 56px);
        margin-top: 56px;
        position: fixed;
        z-index: 100;
    }

    .sidebar.hidden-mobile {
        transform: translateX(-100%);
    }

    .chat-area {
        width: 100%;
        height: calc(100vh - 56px);
        margin-top: 56px;
    }

    .chat-empty-state {
        height: calc(100vh - 56px);
    }

    .message-bubble {
        max-width: 85%;
    }

    .fab {
        display: flex;
    }

    .bottom-nav {
        display: flex;
    }

    .message-input-area {
        padding-bottom: 80px;
    }

    .modal-content {
        width: 95%;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .sidebar-header h2 {
        font-size: 18px;
    }

    .contact-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    .conversation-item,
    .contact-item,
    .call-item {
        padding: 12px 16px;
    }

    .message-bubble {
        max-width: 90%;
    }

    .call-screen {
        padding: 30px 15px;
    }

    .caller-avatar {
        width: 100px;
        height: 100px;
        font-size: 32px;
    }

    .fab {
        bottom: 80px;
        right: 20px;
    }
}