/* Clean Vanilla CSS for SMS Gateway */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info-bg: rgba(59, 130, 246, 0.15);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 1.25rem;
    align-items: center;
}

.navbar-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--primary);
}

.user-badge {
    background-color: var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
    width: 100%;
}

/* Cards & Stats */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--text-main);
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
}

/* Alerts / Flash Messages */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.alert-success {
    background-color: var(--success-bg);
    color: #34d399;
    border: 1px solid var(--success);
}

.alert-error {
    background-color: var(--danger-bg);
    color: #f87171;
    border: 1px solid var(--danger);
}

.alert-info {
    background-color: var(--info-bg);
    color: #60a5fa;
    border: 1px solid var(--primary);
}

/* Token Reveal Alert Box */
.token-reveal-box {
    background: #022c22;
    border: 1px solid #059669;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.token-reveal-title {
    color: #34d399;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.token-copy-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.token-input {
    background: #064e3b;
    color: #a7f3d0;
    border: 1px solid #059669;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.95rem;
    flex: 1;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th, td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-in {
    background-color: #065f46;
    color: #6ee7b7;
}

.badge-out {
    background-color: #1e40af;
    color: #93c5fd;
}

.badge-received {
    background-color: #065f46;
    color: #6ee7b7;
}

.badge-queued {
    background-color: #78350f;
    color: #fcd34d;
}

.badge-sent {
    background-color: #047857;
    color: #a7f3d0;
}

.badge-failed {
    background-color: #881337;
    color: #fda4af;
}

.badge-active {
    background-color: #065f46;
    color: #6ee7b7;
}

.badge-inactive {
    background-color: #4b5563;
    color: #d1d5db;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: #dc2626;
    color: #fff;
}
.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 200px;
}

/* Login Card */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

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

.modal-backdrop.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    padding: 1.5rem;
}

/* CRM Stage Badges */
.badge-lead {
    background-color: #0369a1;
    color: #bae6fd;
}
.badge-contacted {
    background-color: #4338ca;
    color: #c7d2fe;
}
.badge-follow_up {
    background-color: #b45309;
    color: #fde68a;
}
.badge-customer {
    background-color: #047857;
    color: #a7f3d0;
}
.badge-inactive {
    background-color: #374151;
    color: #9ca3af;
}

/* Follow-up Badges */
.badge-overdue {
    background-color: #991b1b;
    color: #fecaca;
}
.badge-today {
    background-color: #b45309;
    color: #fde68a;
}
.badge-upcoming {
    background-color: #1e40af;
    color: #bfdbfe;
}
.badge-completed {
    background-color: #065f46;
    color: #6ee7b7;
}

/* Chat Timeline */
.chat-container {
    background: #0b1120;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
}

.chat-bubble.in {
    align-self: flex-start;
    background: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    border-bottom-left-radius: 2px;
}

.chat-bubble.out {
    align-self: flex-end;
    background: #1d4ed8;
    border: 1px solid #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.35rem;
    justify-content: flex-end;
}

.chat-bubble.in .chat-meta {
    justify-content: flex-start;
    color: var(--text-muted);
}

.chat-reply-bar {
    padding: 0.85rem 1.25rem;
    background: #1e293b;
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* Follow-up task cards */
.followup-item {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.followup-item.is-overdue {
    border-left: 4px solid #ef4444;
}

.followup-item.is-today {
    border-left: 4px solid #f59e0b;
}

.followup-item.is-completed {
    opacity: 0.6;
    border-left: 4px solid #10b981;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}
