:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --border-color: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #8b8b9e;
    --accent-gold: #d4af37;
    --accent-gold-light: #f4d35e;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --whatsapp: #25d366;
    --gradient-gold: linear-gradient(135deg, #d4af37 0%, #f4d35e 50%, #d4af37 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.crown {
    font-size: 28px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    flex: 1;
    padding: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-hover);
    border-radius: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
    background: var(--danger);
    animation: none;
}

.status-dot.connecting {
    background: var(--warning);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--gradient-gold);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent-gold);
}

.btn-warning {
    background: var(--danger);
    color: white;
}

.btn-warning:hover {
    background: #dc2626;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* QR Card */
.qr-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
    text-align: center;
}

.qr-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.qr-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.qr-container {
    margin: 32px auto;
    width: 280px;
    height: 280px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.qr-placeholder {
    text-align: center;
    color: var(--bg-dark);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e5e5;
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#qrCode {
    width: 250px;
    height: 250px;
    border-radius: 12px;
}

.qr-instructions {
    background: var(--bg-hover);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.qr-instructions p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.qr-instructions p:last-child {
    margin-bottom: 0;
}

/* Connected Card */
.connected-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    margin-bottom: 24px;
}

.connected-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.connected-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--success);
}

.phone-number {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.last-activity {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.stat-card.highlight {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0.05) 100%);
    border-color: rgba(212, 175, 55, 0.3);
}

.stat-icon {
    font-size: 32px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-gold);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Activity Card */
.activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.activity-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-hover);
    border-radius: 10px;
    margin-bottom: 10px;
}

.activity-item:last-child {
    margin-bottom: 0;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.activity-icon.received {
    background: rgba(37, 211, 102, 0.15);
}

.activity-icon.sent {
    background: rgba(212, 175, 55, 0.15);
}

.activity-info {
    flex: 1;
}

.activity-phone {
    font-weight: 600;
    font-size: 14px;
}

.activity-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.no-activity, .no-messages, .no-clients {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

/* Messages Section */
.messages-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.messages-container h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.messages-list {
    max-height: 600px;
    overflow-y: auto;
}

.message-item {
    padding: 16px;
    background: var(--bg-hover);
    border-radius: 12px;
    margin-bottom: 12px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-phone {
    font-weight: 600;
    font-size: 14px;
}

.message-direction {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
}

.message-direction.received {
    background: rgba(37, 211, 102, 0.15);
    color: var(--whatsapp);
}

.message-direction.sent {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
}

.message-content {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 100px;
    overflow: hidden;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Clients Section */
.clients-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.clients-container h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.clients-list {
    max-height: 600px;
    overflow-y: auto;
}

.client-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: 12px;
    margin-bottom: 12px;
}

.client-info {
    flex: 1;
}

.client-phone {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.client-actions .btn {
    padding: 8px 16px;
    font-size: 12px;
}

/* Settings Section */
.settings-container {
    max-width: 600px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.settings-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.settings-card.danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.input-group {
    display: flex;
    gap: 12px;
}

.input-group input {
    flex: 1;
    padding: 14px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Trials Management Section */
.trials-container {
    max-width: 1400px;
}

.trials-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.trial-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.trial-stat-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.trials-search-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.trials-search-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.search-input-group {
    display: flex;
    gap: 12px;
}

.search-input-group input {
    flex: 1;
    padding: 14px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-input-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.search-results {
    margin-top: 16px;
}

.search-result-item {
    background: var(--bg-hover);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-mac {
    font-weight: 600;
    font-size: 14px;
}

.search-result-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.trials-list-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.trials-table-container {
    overflow-x: auto;
}

.trials-table {
    width: 100%;
    border-collapse: collapse;
}

.trials-table th,
.trials-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.trials-table th {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--bg-hover);
}

.trials-table th:first-child {
    border-radius: 8px 0 0 8px;
}

.trials-table th:last-child {
    border-radius: 0 8px 8px 0;
}

.trials-table td {
    font-size: 13px;
}

.trials-table tr:hover td {
    background: rgba(212, 175, 55, 0.05);
}

.trials-table .no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.available {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status-badge.in-use {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.status-badge.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
}

.status-badge.expired {
    background: rgba(139, 139, 158, 0.15);
    color: var(--text-secondary);
}

.time-remaining {
    font-weight: 600;
}

.time-remaining.warning {
    color: var(--warning);
}

.time-remaining.danger {
    color: var(--danger);
}

.action-btn {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.action-btn.reset {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.action-btn.reset:hover {
    background: var(--danger);
    color: white;
}

.action-btn.unblock {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.action-btn.unblock:hover {
    background: var(--success);
    color: white;
}

.action-btn.free {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.action-btn.free:hover {
    background: #3b82f6;
    color: white;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
}

.modal h3 {
    margin-bottom: 20px;
}

.modal-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 12px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .trials-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .logo-text, .nav-item span:not(.nav-icon), .status-text {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trials-stats-grid {
        grid-template-columns: 1fr;
    }
}
