:root {
    --primary-color: #7367f0;
    --primary-hover: #685dd8;
    --bg-color: #f8f7fa;
    --card-bg: #ffffff;
    --text-color: #5e5873;
    --heading-color: #5e5873;
    --border-color: #ebe9f1;
    --success-color: #28c76f;
    --warning-color: #ff9f43;
    --danger-color: #ea5455;
    --muted-text: #b9b9c3;
    --body-font: 'Inter', sans-serif;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--body-font);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 14px;
    /* SaaS standard */
    line-height: 1.5;
}

/* Layout */
body {
    background-color: var(--bg-color);
}

.app-container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

.top-bar {
    padding: 15px 40px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
}

.top-bar h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-wrapper {
    padding: 30px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Breadcrumbs / Back navigation styles override */
.breadcrumbs {
    display: flex;
    align-items: center;
}


/* Toolbar */
.toolbar {
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: none;
    gap: 20px;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid #e1e0e6;
    border-radius: 50px;
    /* Fully rounded */
    outline: none;
    font-size: 14px;
    color: var(--text-color);
    background-color: #fcfcfd;
    transition: box-shadow 0.2s;
}

.search-box input:focus {
    box-shadow: 0 0 0 2px rgba(115, 103, 240, 0.1);
    border-color: var(--primary-color);
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-text);
    font-size: 16px;
}

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

.filter-dropdown {
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 8px 12px;
    border: 1px solid transparent;
    /* Subtle border if needed */
    border-radius: 4px;
}

.filter-dropdown:hover {
    background: #f1f1f1;
}

.filter-dropdown span {
    color: var(--muted-text);
    margin-right: 5px;
}

.btn-primary {
    background-color: white;
    /* White background */
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    /* Outline */
    border-radius: 4px;
    padding: 8px 16px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-primary:hover {
    background-color: rgba(115, 103, 240, 0.08);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #f8f8f8;
}

/* Table */
.table-container {
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.02);
    /* Very light shadow */
    overflow: hidden;
    padding: 20px;
    /* Some padding around the table */
}

.channels-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.channels-table th {
    text-align: left;
    padding: 15px 10px;
    background-color: #fcfcfd;
    /* Very subtle grey */
    font-size: 11px;
    font-weight: 700;
    color: #b9b9c3;
    /* Lighter heading color */
    text-transform: uppercase;
    border-bottom: none;
}

.channels-table td {
    padding: 20px 10px;
    border-bottom: 1px solid #f6f6f6;
    /* Very light separator */
    color: var(--heading-color);
    font-weight: 500;
    vertical-align: middle;
}

.channels-table tr:hover td {
    background-color: #fafafc;
    /* Hover effect */
}

/* Row selection style */
.channels-table tr.selected td {
    background-color: rgba(115, 103, 240, 0.05);
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 15px;
    /* More space */
}

.channel-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    /* Softer rounded square */
    background-color: #e5f8ed;
    /* Light green bg */
    color: #28c76f;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.channel-details h4 {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--heading-color);
}

.channel-details span {
    font-size: 11px;
    color: var(--muted-text);
    display: block;
}

.trial-badge-small {
    border: 1px solid #ff9f43;
    color: #ff9f43;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 5px;
    display: inline-block;
    vertical-align: text-top;
}

/* Status Badges - Detailed */
.status-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.5px;
}

.status-badge.connected {
    background-color: rgba(115, 103, 240, 0.12);
    /* Light Purple */
    color: var(--primary-color);
}

.status-badge.stopped {
    background-color: rgba(115, 103, 240, 0.12);
    /* Also light purple for base? Or pinkish? */
    /* Based on image: light purple/pink background with Red Dot */
    color: var(--text-color);
}

.status-badge.stopped::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ea5455;
    /* Red dot */
}

.status-badge.connected i {
    font-size: 10px;
    /* Checkmark icon */
}

.status-badge.scanning {
    background-color: rgba(115, 103, 240, 0.12);
    color: var(--primary-color);
}


/* Work Period Badges */
.work-period-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
}

.work-period-badge.overdue {
    background-color: #ffdede;
    /* Light Red */
    color: #ea5455;
    font-weight: 500;
}

.work-period-badge.trial {
    background-color: #ffeeda;
    /* Light Orange */
    color: #ff9f43;
    font-weight: 500;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 800px;
    max-width: 90%;
    animation: slideIn 0.3s ease;
}

.modal-content.large-modal {
    width: 800px;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted-text);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

/* Wizard */
.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 50px;
    background-color: #f8f8f8;
    border-bottom: 1px solid var(--border-color);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted-text);
    position: relative;
}

.step.active {
    color: var(--primary-color);
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    background-color: white;
    border: 1px solid var(--border-color);
    z-index: 2;
}

.step.active .step-icon {
    border-color: var(--primary-color);
    background-color: rgba(115, 103, 240, 0.1);
}

.step.completed .step-icon {
    border-color: #28c76f;
    background-color: rgba(40, 199, 111, 0.1);
    color: #28c76f;
}

/* Success View */
.success-body {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.step-line {
    flex: 1;
    height: 2px;
    background-color: var(--border-color);
    margin: 0 10px;
    transform: translateY(-14px);
    /* Align with icon center approximately */
}

.connection-body {
    display: flex;
    min-height: 400px;
}

.qr-section {
    flex: 1;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.instructions-section {
    flex: 1;
    padding: 30px;
}

.qr-container {
    width: 260px;
    height: 260px;
    border: 1px solid var(--border-color);
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}

.qr-placeholder {
    color: var(--muted-text);
}

.qr-container img {
    width: 100%;
    height: 100%;
}

.link-btn {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.instructions-section ol {
    margin-top: 20px;
    padding-left: 20px;
    line-height: 2;
}

/* Loading Spinner */
.loader {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
    display: block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.empty-state {
    padding: 50px;
    text-align: center;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.05);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}


/* Channel Details View */
.channel-details-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: slideIn 0.3s ease;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
}

.header-status {
    display: none;
    /* Hidden in new design as it's in the card */
}

/* 3-Column Layout */
.details-grid {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.col-profile {
    flex: 1;
    min-width: 300px;
    max-width: 350px;
}

.col-main {
    flex: 1.5;
    min-width: 350px;
}

.col-tools {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}


/* Profile Card */
.profile-card {
    padding: 0 !important;
    overflow: hidden;
    text-align: center;
}

.profile-banner {
    background: linear-gradient(135deg, #7367f0 0%, #685dd8 100%);
    height: 100px;
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 15px;
    gap: 10px;
}

.banner-icon-bg {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%) rotate(-15deg);
    font-size: 80px;
    color: rgba(255, 255, 255, 0.1);
}

.banner-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.banner-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.disconnect-badge {
    background-color: var(--warning-color);
}

.delete-badge {
    background-color: var(--danger-color);
}

.profile-content {
    padding: 0 24px 30px 24px;
    margin-top: -40px;
    position: relative;
    z-index: 2;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: #d0d2d6;
    /* Fallback grey */
    border-radius: 50%;
    margin: 0 auto 15px auto;
    border: 4px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    color: white;
    position: relative;
}

.wa-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: white;
    border-radius: 50%;
    padding: 2px;
    color: #28c76f;
    font-size: 16px;
    display: flex;
}

.profile-content h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: var(--heading-color);
}

.phone-number {
    margin: 0 0 20px 0;
    color: var(--text-color);
    font-size: 14px;
}

.auth-status {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.auth-status h4 {
    margin: 0 0 5px 0;
    color: var(--heading-color);
    font-size: 13px;
    font-weight: 700;
}

.auth-status p {
    margin: 0;
    font-size: 11px;
    color: var(--muted-text);
}


/* Main Stats Card */
.stats-card {
    padding: 0 !important;
}

.plan-header {
    background: #fff8f3;
    /* Light orange bg */
    padding: 24px;
    border-bottom: 1px dashed #ffdcb0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.plan-icon {
    width: 40px;
    height: 40px;
    background: #ff9f43;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.plan-info h4 {
    margin: 0;
    font-size: 16px;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-trial {
    border: 1px solid #ff9f43;
    color: #ff9f43;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
}

.plan-info p {
    margin: 3px 0 0 0;
    font-size: 12px;
    color: var(--heading-color);
    font-weight: 600;
}

.btn-outline-orange {
    background: transparent;
    border: 1px solid #ff9f43;
    color: #ff9f43;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.trial-warning {
    background: #fff8f3;
    padding: 10px 24px;
    color: #ff9f43;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-stats {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.stat-icon.purple {
    background: #7367f0;
}

.stat-icon.blue {
    background: #00cfe8;
}

.stat-text {
    display: flex;
    flex-direction: column;
}

.stat-text label {
    font-size: 12px;
    color: #5e5873;
    font-weight: 600;
    margin-bottom: 2px;
}

.stat-text span {
    font-size: 20px;
    font-weight: 700;
}

.purple-text {
    color: #7367f0;
}

.blue-text {
    color: #00cfe8;
}

.orange-text {
    color: #ff9f43;
}


.api-credentials-section {
    padding: 24px;
    background: #fafafc;
}

.api-row {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

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

.api-row label {
    width: 80px;
    font-size: 13px;
    font-weight: 700;
    color: var(--heading-color);
}

.api-value {
    font-family: monospace;
    color: var(--text-color);
    font-size: 13px;
    margin-right: 10px;
}

.api-value.blurred {
    filter: blur(3px);
    cursor: pointer;
    transition: filter 0.2s;
}

.api-value.blurred:hover {
    filter: none;
}

.copy-icon {
    color: #b9b9c3;
    cursor: pointer;
    font-size: 14px;
}

.copy-icon:hover {
    color: var(--primary-color);
}


/* Right Column Tools */
.tool-card {
    padding: 20px;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tool-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--heading-color);
}

.tool-actions {
    display: flex;
    gap: 8px;
}

.btn-xs-purple {
    background: rgba(115, 103, 240, 0.12);
    color: var(--primary-color);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.btn-xs-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
}

.link-blue {
    color: #00cfe8;
    text-decoration: none;
    font-size: 13px;
}

.tool-card.highlight {
    background: #fafafc;
    border: 1px dashed var(--border-color);
}

.tool-card.highlight p {
    font-size: 11px;
    color: var(--muted-text);
    margin: 10px 0 0 0;
}

.btn-solid-purple {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.btn-solid-blue {
    background: #00cfe8;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.btn-action-small {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-action-small:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(115, 103, 240, 0.2);
}

.highlight-blue {
    background: rgba(0, 207, 232, 0.12);
    border: none;
}

/* Login Page Styles */
.login-body {
    background-color: #f8f7fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--heading-color);
    margin: 0 0 5px 0;
}

.login-header p {
    color: var(--muted-text);
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--heading-color);
}

.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d8d6de;
    border-radius: 5px;
    font-size: 14px;
    color: var(--text-color);
    transition: all 0.2s;
}

.login-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(115, 103, 240, 0.1);
    /* Primary color shadow */
    outline: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted-text);
}

#error {
    background: #FFDCDC;
    color: #cb2027;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    margin-top: 15px;
}

.api-methods-section h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--heading-color);
}

.method-list {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.05);
}

.method-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 15px;
}

.method-item:last-child {
    border-bottom: none;
}

.method-badge {
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.method-badge.get {
    background-color: #00cfe8;
}

.method-badge.post {
    background-color: #28c76f;
}

.method-badge.delete {
    background-color: #ea5455;
}

.method-badge.patch {
    background-color: #7367f0;
}

.method-url {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-color);
}

.method-desc {
    flex: 1;
    color: var(--muted-text);
    font-size: 12px;
}

.method-item i {
    color: var(--muted-text);
    font-size: 12px;
}

/* Channel Details View Header & Back Button */
.channel-details-view {
    padding-top: 10px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.btn-back {
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 18px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-back:hover {
    background-color: #fcfcfd;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateX(-4px);
    box-shadow: 0 4px 8px rgba(115, 103, 240, 0.1);
}

.btn-back i {
    font-size: 15px;
    transition: transform 0.2s;
}

.btn-back:hover i {
    transform: scale(1.1);
}

.header-status .status-badge {
    padding: 8px 16px;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}