/* ==========================================================================
   TRACKARA PRO MARKETPLACE PORTAL - SHARED STYLES
   Built on existing design system from index.html
   ========================================================================== */

/* ==========================================================================
   CSS VARIABLES - DESIGN TOKENS
   ========================================================================== */
:root {
    /* Brand Colors */
    --primary-color: #17afa5;
    --primary-dark: #0d8b82;
    --primary-light: #1fc4b8;
    --primary-glow: rgba(23, 175, 165, 0.3);

    /* Dark Theme */
    --bg-black: #0a0a0a;
    --bg-dark: #121212;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --border-dark: #2a2a2a;
    --border-light: #333333;

    /* Text */
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;

    /* Accents */
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;

    /* Status */
    --status-pending: #f59e0b;
    --status-confirmed: #3b82f6;
    --status-in-progress: #8b5cf6;
    --status-completed: #10b981;
    --status-cancelled: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background: var(--bg-black);
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   PORTAL HEADER
   ========================================================================== */
.portal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: rgba(10, 10, 10, 0.9);
    border-bottom: 1px solid var(--border-dark);
}

.portal-header .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.portal-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-logo span { color: var(--primary-color); }

.portal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-nav a {
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s;
}

.portal-nav a:hover { color: var(--primary-color); background: rgba(23,175,165,0.1); }
.portal-nav a.active { color: var(--primary-color); background: rgba(23,175,165,0.15); }

.portal-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(23, 175, 165, 0.3);
}
.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 175, 165, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success { background: var(--accent-green); color: white; }
.btn-danger { background: var(--accent-red); color: white; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-block { width: 100%; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(23, 175, 165, 0.15);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23737373'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

.form-textarea { min-height: 120px; resize: vertical; font-family: inherit; }

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    background: var(--bg-card);
    border: 2px solid var(--border-dark);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 16px;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(23, 175, 165, 0.15);
}

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

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s;
}

.card:hover {
    border-color: var(--border-light);
}

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

.card-title {
    font-size: 18px;
    font-weight: 700;
}

/* Mechanic Card */
.mechanic-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mechanic-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(23, 175, 165, 0.15);
}

.mechanic-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.mechanic-avatar {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 28px;
    flex-shrink: 0;
}

.mechanic-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.mechanic-info { flex: 1; }

.mechanic-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.mechanic-specialty {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.mechanic-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mechanic-rating i { color: var(--accent-orange); font-size: 14px; }
.mechanic-rating span { color: var(--text-secondary); font-size: 14px; }

.mechanic-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
}

.mechanic-stat {
    text-align: center;
}

.mechanic-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.mechanic-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.mechanic-services {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.service-tag {
    padding: 6px 12px;
    background: var(--bg-dark);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Job Card */
.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.job-card:hover { background: var(--bg-card-hover); }

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.job-customer {
    color: var(--text-secondary);
    font-size: 14px;
}

.job-details {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.job-details i { color: var(--primary-color); }

/* ==========================================================================
   BADGES & STATUS
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: rgba(23,175,165,0.15); color: var(--primary-color); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--accent-blue); }

.status-pending { background: rgba(245,158,11,0.15); color: var(--status-pending); }
.status-confirmed { background: rgba(59,130,246,0.15); color: var(--status-confirmed); }
.status-in-progress { background: rgba(139,92,246,0.15); color: var(--status-in-progress); }
.status-completed { background: rgba(16,185,129,0.15); color: var(--status-completed); }
.status-cancelled { background: rgba(239,68,68,0.15); color: var(--status-cancelled); }

/* ==========================================================================
   STATS & METRICS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(23,175,165,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--primary-color);
    font-size: 20px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==========================================================================
   RATING STARS
   ========================================================================== */
.rating-stars { display: inline-flex; gap: 2px; }
.rating-stars i { color: var(--accent-orange); }
.rating-stars i.empty { color: var(--border-light); }

/* ==========================================================================
   AVATARS
   ========================================================================== */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-dark);
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 96px; height: 96px; }

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    color: var(--text-muted);
}

/* ==========================================================================
   TABS
   ========================================================================== */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-dark);
    padding-bottom: 0;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 24px;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s;
}

.modal-overlay.active .modal { transform: scale(1) translateY(0); }

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

.modal-title { font-size: 20px; font-weight: 700; }

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-dark);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    top: clamp(70px, 12vh, 90px);
    right: clamp(12px, 3vw, 24px);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: min(320px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.warning { border-left: 4px solid var(--accent-orange); }
.toast.info { border-left: 4px solid var(--accent-blue); }

.toast-icon { font-size: 20px; }
.toast.success .toast-icon { color: var(--accent-green); }
.toast.error .toast-icon { color: var(--accent-red); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-message { font-size: 14px; color: var(--text-secondary); }

/* ==========================================================================
   LOADING STATES
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 5000;
}

/* ==========================================================================
   TIMELINE / STEPS
   ========================================================================== */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-dark);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -40px;
    top: 4px;
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border: 2px solid var(--border-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-item.completed .timeline-dot {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.timeline-item.active .timeline-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(23, 175, 165, 0.3);
}

.timeline-content h4 { font-weight: 600; margin-bottom: 4px; }
.timeline-content p { color: var(--text-secondary); font-size: 14px; }
.timeline-time { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ==========================================================================
   PRICE DISPLAY
   ========================================================================== */
.price { font-size: 28px; font-weight: 800; color: var(--primary-color); }
.price small { font-size: 14px; font-weight: 400; color: var(--text-muted); }

.price-breakdown {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 16px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-dark);
}

.price-row:last-child { border-bottom: none; }
.price-row.total { font-weight: 700; font-size: 18px; color: var(--primary-color); }

/* ==========================================================================
   MAP CONTAINER
   ========================================================================== */
.map-container {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
}

.map-container iframe { width: 100%; height: 100%; border: none; }

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--text-muted);
    font-size: 32px;
}

.empty-state h3 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 24px; }

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.page-content { padding-top: 100px; padding-bottom: 60px; min-height: 100vh; }

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

.section-title { font-size: 24px; font-weight: 700; }

/* Grid - Using !important to override Tailwind conflicts */
.grid { display: grid !important; gap: 24px !important; }
.grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
.grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
.grid-4 { grid-template-columns: repeat(4, 1fr) !important; }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
    .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr !important; }
    .page-content { padding-top: 80px; }
}

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* Text */
.text-center { text-align: center; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* Spacing */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* Visibility */
.hidden { display: none !important; }

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* ==========================================================================
   GRADIENT TEXT
   ========================================================================== */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   VERIFIED BADGES
   ========================================================================== */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.verified-badge i { font-size: 10px; }

/* ==========================================================================
   SIDEBAR LAYOUT (for dashboards)
   ========================================================================== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.dashboard-sidebar {
    width: 260px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-dark);
    padding: 24px;
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.dashboard-main {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    padding-top: 94px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover { color: var(--text-primary); background: var(--bg-card); }
.sidebar-link.active { color: var(--primary-color); background: rgba(23,175,165,0.15); }
.sidebar-link i { width: 20px; text-align: center; }

@media (max-width: 1024px) {
    .dashboard-sidebar { display: none; }
    .dashboard-main { margin-left: 0; }
}

/* ==========================================================================
   RESPONSIVE MOBILE STYLES
   ========================================================================== */
@media (max-width: 1023px) {
    .portal-header .container {
        padding: 0 16px;
        height: 60px;
    }

    .portal-nav {
        gap: 4px;
    }

    .portal-nav a {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 767px) {
    .toast-container {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 20px;
    }

    .toast {
        width: 100%;
        min-width: unset;
    }

    .portal-header .container {
        padding: 0 12px;
        height: 56px;
    }

    .portal-logo {
        font-size: 18px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-lg {
        padding: 12px 20px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Card responsiveness */
    .card {
        padding: 16px;
        border-radius: 12px;
    }

    /* Flex containers wrap */
    .flex-row,
    [class*="flex"] {
        flex-wrap: wrap;
    }
}

@media (max-width: 599px) {
    .portal-header .container {
        height: 52px;
    }

    .portal-logo {
        font-size: 16px;
    }

    .portal-nav a span {
        display: none;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .btn i + span {
        display: none;
    }

    /* Stack buttons vertically */
    .btn-group,
    .button-row {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn,
    .button-row .btn {
        width: 100%;
    }
}

@media (max-width: 479px) {
    .toast {
        padding: 12px 16px;
    }

    .toast-icon {
        font-size: 18px;
    }

    .toast-title {
        font-size: 14px;
    }

    .toast-message {
        font-size: 13px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .card {
        padding: 12px;
        border-radius: 10px;
    }

    .form-label {
        font-size: 12px;
    }

    .form-input,
    .form-select {
        padding: 8px 10px;
    }

    /* Full width form elements */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* ==========================================================================
   EMAIL MARKETING — TEMPLATE BUILDER
   ========================================================================== */
.template-builder {
    position: fixed;
    inset: 0;
    background: var(--bg-black);
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.template-builder.active {
    display: flex;
}

.builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-dark);
    gap: 16px;
    flex-shrink: 0;
}

.builder-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.builder-header-fields {
    display: flex;
    gap: 12px;
    flex: 1;
}

.builder-header-fields input {
    padding: 8px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
}

.builder-header-fields input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.builder-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.block-palette {
    width: 200px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-dark);
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
}

.block-palette h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.block-palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.block-palette-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(23, 175, 165, 0.05);
}

.block-palette-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.builder-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.email-preview-pane {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    justify-content: center;
    background: #050505;
}

.email-preview-pane iframe {
    width: 600px;
    max-width: 100%;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    background: #0a0a0a;
    min-height: 400px;
}

.block-editor-panel {
    background: var(--bg-card);
    border-top: 1px solid var(--border-dark);
    padding: 20px 24px;
    max-height: 300px;
    overflow-y: auto;
    flex-shrink: 0;
}

.block-editor-panel h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.block-editor-panel .form-group {
    margin-bottom: 12px;
}

.block-editor-panel label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.block-editor-panel input,
.block-editor-panel textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}

.block-editor-panel input:focus,
.block-editor-panel textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.block-editor-panel textarea {
    min-height: 60px;
    resize: vertical;
}

.builder-sidebar-right {
    width: 260px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-dark);
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
}

.builder-sidebar-right h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.block-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.block-list-item:hover {
    border-color: var(--border-light);
}

.block-list-item.selected {
    border-color: var(--primary-color);
    background: rgba(23, 175, 165, 0.08);
}

.block-list-item .block-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.block-list-item .block-actions {
    display: flex;
    gap: 4px;
}

.block-list-item .block-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    border-radius: 4px;
}

.block-list-item .block-actions button:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.block-list-item .block-actions button.delete-btn:hover {
    color: var(--accent-red);
}

/* ==========================================================================
   EMAIL MARKETING — CAMPAIGN COMPOSER
   ========================================================================== */
.campaign-composer {
    position: fixed;
    inset: 0;
    background: var(--bg-black);
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.campaign-composer.active {
    display: flex;
}

.composer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-dark);
    flex-shrink: 0;
}

.composer-steps {
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-dark);
}

.composer-step.active {
    background: rgba(23, 175, 165, 0.15);
    color: var(--primary-color);
}

.composer-step.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.composer-step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--border-dark);
    color: var(--text-muted);
}

.composer-step.active .composer-step-number {
    background: var(--primary-color);
    color: white;
}

.composer-step.completed .composer-step-number {
    background: var(--accent-green);
    color: white;
}

.composer-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.composer-content {
    max-width: 720px;
    margin: 0 auto;
}

.composer-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-dark);
    flex-shrink: 0;
}

/* ==========================================================================
   EMAIL MARKETING — TEMPLATE GRID
   ========================================================================== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.template-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(23, 175, 165, 0.15);
}

.template-card-preview {
    height: 160px;
    background: linear-gradient(135deg, #0B1015, #132226);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-dark);
    overflow: hidden;
}

.template-card-preview iframe {
    width: 600px;
    height: 500px;
    transform: scale(0.28);
    transform-origin: top center;
    pointer-events: none;
    border: none;
}

.template-card-body {
    padding: 16px;
}

.template-card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.template-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.template-card-actions button {
    padding: 6px 12px;
    font-size: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.template-card-actions button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==========================================================================
   EMAIL MARKETING — CAMPAIGN CARDS / TABLE
   ========================================================================== */
.campaign-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.campaign-status.draft { background: rgba(115, 115, 115, 0.15); color: #737373; }
.campaign-status.scheduled { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.campaign-status.sending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.campaign-status.sent { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.campaign-status.paused { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.campaign-status.failed { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* ==========================================================================
   EMAIL MARKETING — DRIP TIMELINE
   ========================================================================== */
.drip-editor {
    position: fixed;
    inset: 0;
    background: var(--bg-black);
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.drip-editor.active {
    display: flex;
}

.drip-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 32px 24px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.drip-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
    position: relative;
    flex-shrink: 0;
}

.drip-step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-dark);
}

.drip-step:last-child::after {
    display: none;
}

.drip-step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
}

.drip-step-dot.disabled {
    background: var(--border-dark);
    color: var(--text-muted);
}

.drip-step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 16px;
    width: 160px;
    text-align: center;
}

.drip-step-card h5 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.drip-step-card p {
    font-size: 12px;
    color: var(--text-muted);
}

.drip-step-delay {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 8px;
}

/* ==========================================================================
   EMAIL MARKETING — PROGRESS BAR
   ========================================================================== */
.progress-bar-container {
    background: var(--bg-dark);
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 8px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   EMAIL MARKETING — FILTER CHIPS
   ========================================================================== */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: var(--primary-color);
}

.filter-chip.active {
    background: rgba(23, 175, 165, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-chip input[type="checkbox"] {
    display: none;
}

.recipient-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(23, 175, 165, 0.08);
    border: 1px solid rgba(23, 175, 165, 0.2);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);
}

.recipient-count i {
    font-size: 18px;
}

/* ==========================================================================
   EMAIL MARKETING — RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .block-palette {
        width: 160px;
    }

    .builder-sidebar-right {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .block-palette {
        display: none;
    }

    .builder-sidebar-right {
        display: none;
    }

    .builder-header-fields {
        flex-direction: column;
    }

    .builder-header-fields input {
        min-width: 120px;
    }

    .composer-steps {
        overflow-x: auto;
    }

    .drip-timeline {
        padding: 16px;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }
}
