/* ========================================
   SOCIAL MESSAGING THEME - Modern Design
   ======================================== */

:root {
    /* Social Messaging Colors */
    --office-primary: #0d7a3e;
    /* Deep Green */
    --office-primary-light: #25d366;
    /* WhatsApp Green */
    --office-primary-dark: #0a5c2f;
    /* Darker Green */
    --office-accent: #2dd4bf;
    /* Teal Accent */
    --office-secondary: #64748b;
    /* Slate Gray */

    /* Neutral Professional Palette */
    --office-white: #ffffff;
    --office-gray-50: #f0fdf4;
    --office-gray-100: #ecfdf5;
    --office-gray-200: #d1fae5;
    --office-gray-300: #a7f3d0;
    --office-gray-400: #6ee7b7;
    --office-gray-500: #64748b;
    --office-gray-600: #475569;
    --office-gray-700: #334155;
    --office-gray-800: #1e293b;
    --office-gray-900: #0f172a;

    /* Status Colors */
    --office-success: #25d366;
    --office-warning: #f59e0b;
    --office-error: #ef4444;
    --office-info: #2dd4bf;

    /* Gradients */
    --gradient-office: linear-gradient(135deg, #25d366 0%, #2dd4bf 100%);
    --gradient-light: linear-gradient(135deg, #ecfdf5 0%, #ccfbf1 100%);
    --gradient-card: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows - Professional & Subtle */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--office-gray-800);
    background: var(--office-gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   LAYOUT
   ======================================== */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--office-gray-100);
}

/* ========================================
   SIDEBAR - Professional Office Style
   ======================================== */

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #064e3b 0%, #065f46 50%, #047857 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(6, 78, 59, 0.15);
    position: relative;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
    padding: var(--space-xl) var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand h2::before {
    content: '💬';
    font-size: 1.75rem;
}

.menu {
    flex: 1;
    padding: var(--space-lg) 0;
    overflow-y: auto;
}

.menu::-webkit-scrollbar {
    width: 6px;
}

.menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
}

.menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.menu-separator {
    margin: var(--space-lg) var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.75rem var(--space-lg);
    margin: var(--space-xs) var(--space-md);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9375rem;
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0;
    transition: opacity var(--transition-base);
    border-radius: var(--radius-md);
}

.menu-item:hover::before {
    opacity: 1;
}

.menu-item:hover {
    color: white;
    transform: translateX(4px);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.menu-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: white;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.menu-item .icon {
    font-size: 1.25rem;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.device-list {
    max-height: 300px;
    overflow-y: auto;
}

.device-item {
    font-size: 0.875rem;
    padding: var(--space-sm) var(--space-lg);
}

.connection-status {
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--office-gray-400);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot.connected {
    background: var(--office-success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   MAIN CONTENT - Professional Layout
   ======================================== */

.main-content {
    flex: 1;
    padding: var(--space-2xl);
    overflow-y: auto;
    background: var(--office-gray-50);
    position: relative;
    scroll-behavior: smooth;
}

.view {
    display: none;
    animation: fadeIn var(--transition-base);
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   HEADERS - Professional Typography
   ======================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--office-gray-200);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--office-gray-900);
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--office-gray-800);
    margin-bottom: var(--space-md);
}

/* ========================================
   CARDS - Modern Office Style
   ======================================== */

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--office-gray-200);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--office-gray-300);
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--office-gray-200);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-office);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--office-primary-light);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--office-gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--office-gray-900);
    line-height: 1;
}

/* ========================================
   BUTTONS - Professional Style
   ======================================== */

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    font-weight: 600;
}

.btn-primary {
    background: var(--gradient-office);
    color: #0a1628;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    font-size: 0.9375rem;
    border: none;
    font-weight: 700;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--office-gray-700);
    border: 2px solid var(--office-gray-300);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
}

.btn-secondary:hover {
    background: var(--office-gray-50);
    border-color: var(--office-primary);
    color: var(--office-primary);
}

/* ========================================
   FORMS - Professional Input Style
   ======================================== */

.form-group {
    margin-bottom: var(--space-lg);
}

label {
    display: block;
    font-weight: 600;
    color: var(--office-gray-700);
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--office-gray-200);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    background: white;
    color: var(--office-gray-800);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--office-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ========================================
   TABLES - Professional Data Display
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--office-gray-700);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--office-gray-50);
    border-bottom: 2px solid var(--office-gray-200);
}

td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--office-gray-200);
}

tbody tr {
    transition: background-color var(--transition-fast);
}

tbody tr:hover {
    background: var(--office-gray-50);
}

/* ========================================
   MODALS - Professional Dialog Style
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeInOverlay var(--transition-base);
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    width: 480px;
    max-width: calc(100% - 40px);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--office-gray-200);
    background: white;
    transform: translateY(-12px) scale(0.98);
    opacity: 0;
    transition: transform 220ms var(--transition-base), opacity 220ms var(--transition-base);
}

.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--office-gray-100);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--office-gray-900);
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--office-gray-500);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.modal-close:hover {
    background: var(--office-gray-100);
    color: var(--office-gray-700);
}

.modal-body {
    padding: var(--space-md) 0;
}

.modal-footer {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--office-gray-100);
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ========================================
   QR CODE - Professional Display
   ======================================== */

#qr-container {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    border: 2px dashed var(--office-gray-300);
}

#qr-image {
    max-width: 280px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 4px solid white;
}

.placeholder {
    color: var(--office-gray-400);
    font-size: 1.125rem;
    text-align: center;
    font-weight: 500;
}

/* ========================================
   LOGS - Professional Log Display
   ======================================== */

#logs-container {
    max-height: 500px;
    overflow-y: auto;
}

.log-entry {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    border-left: 4px solid var(--office-gray-300);
    background: white;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.log-entry:hover {
    background: var(--office-gray-50);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.log-entry.sent {
    border-left-color: var(--office-info);
}

.log-entry.received {
    border-left-color: var(--office-success);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

#toast-container {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.toast {
    min-width: 320px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    border-left: 4px solid var(--office-info);
    animation: slideIn var(--transition-base);
}

.toast.success {
    border-left-color: var(--office-success);
}

.toast.error {
    border-left-color: var(--office-error);
}

.toast.warning {
    border-left-color: var(--office-warning);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--office-gray-900);
    margin-bottom: var(--space-xs);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--office-gray-600);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

.mobile-header {
    display: none;
    height: 60px;
    background: white;
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--office-gray-200);
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background: #25d366;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1090;
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left var(--transition-base);
        z-index: 1100;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: var(--space-lg);
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* ========================================
   CODE BLOCKS - For Documentation
   ======================================== */

code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--office-gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--office-primary);
}

pre {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--office-gray-900);
    color: var(--office-gray-100);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    overflow-x: auto;
    line-height: 1.6;
}

.code-block-wrapper {
    position: relative;
    margin: var(--space-md) 0;
}

.copy-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
    background: var(--office-success);
    border-color: var(--office-success);
}