:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --sidebar-width: 260px;
}

* {
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    margin: 0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    color: white;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-section {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--gray-400);
    text-decoration: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    border-left-color: var(--primary);
}

.nav-item i {
    font-size: 1.1rem;
    width: 24px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
}

.breadcrumb-nav .current {
    color: var(--dark);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.company-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: 8px;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* Page Content */
.page-content {
    padding: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-200);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.blue { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.stat-icon.purple { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.stat-change {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
}

.stat-change.positive { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-change.negative { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Content Card */
.content-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.card-title {
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.card-body-custom {
    padding: 1.5rem;
}

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: box-shadow 0.2s;
}

.btn-primary-custom:hover {
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary-custom {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary-custom:hover {
    background: var(--gray-200);
    color: var(--dark);
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-100);
    font-weight: 600;
}

.table-custom td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-600);
}

.table-custom tbody tr:hover {
    background: var(--gray-100);
}

/* Badges */
.badge-status {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-active, .badge-warmed, .badge-completed { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warming, .badge-scheduled { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-paused, .badge-not_contacted { background: rgba(100, 116, 139, 0.1); color: var(--gray-500); }
.badge-draft, .badge-company_admin { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.badge-sending, .badge-clicked, .badge-opened { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.badge-bounced, .badge-failed { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-sent, .badge-contacted { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.badge-replied { background: rgba(16, 185, 129, 0.12); color: #10b981; font-weight: 600; }

/* Funnel */
.funnel-stage {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.funnel-bar-container {
    flex: 1;
    margin-right: 1rem;
}

.funnel-bar {
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: white;
    font-weight: 600;
    min-width: 60px;
}

.funnel-stats {
    width: 120px;
    text-align: right;
}

.funnel-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
}

.funnel-rate {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Activity */
.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.sent { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.activity-icon.opened { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.activity-icon.clicked { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.activity-icon.bounced { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.activity-text {
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Form */
.form-label-custom {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: block;
}

.form-control-custom {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Password Input with Toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary);
}

.password-toggle i {
    font-size: 1.1rem;
}

/* Warmup Progress */
.warmup-progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.warmup-progress-bar {
    height: 100%;
    border-radius: 4px;
}

/* Template Preview */
.template-preview {
    background: var(--gray-100);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px dashed var(--gray-300);
}

.merge-tag {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* Avatar Group */
.avatar-group {
    display: flex;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.avatar-sm:first-child {
    margin-left: 0;
}

/* Add Card */
.add-card {
    border: 2px dashed var(--gray-300);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
}

/* Auth Pages */
.guest-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-500);
    margin: 0;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }
}
