/* ============================================
   SIDEQUEST DIGITAL - Portal CSS (Clean)
   ============================================ */

:root {
    --color-bg-primary: #12131a;
    --color-bg-secondary: #1a1b23;
    --color-bg-tertiary: #22232d;
    --color-bg-hover: #2a2b38;
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #a0a0a0;
    --color-text-muted: #666;
    --color-primary: #7c3aed;
    --color-primary-hover: #6d28d9;
    --color-border: #2d2e3a;
    --color-border-subtle: rgba(255,255,255,0.08);
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --sidebar-width: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--color-bg-primary); color: var(--color-text-primary); line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-primary); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* Layout */
.portal-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--color-bg-secondary); border-right: 1px solid var(--color-border-subtle); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }
.page-content { padding: 24px 32px; }

/* Sidebar */
.sidebar-header { padding: 20px 24px; border-bottom: 1px solid var(--color-border-subtle); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.sidebar-logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--color-primary), #f97316); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted); padding: 0 12px; margin-bottom: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--color-text-secondary); font-size: 14px; font-weight: 500; transition: all 0.15s; margin-bottom: 2px; }
.nav-item:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.nav-item.active { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }
.nav-item svg { width: 20px; height: 20px; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--color-border-subtle); }
.user-card { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-md); cursor: pointer; }
.user-card:hover { background: var(--color-bg-hover); }
.user-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); background: linear-gradient(135deg, var(--color-primary), #8b5cf6); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.user-info { flex: 1; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--color-text-muted); }

/* Header */
.header { height: 64px; background: var(--color-bg-secondary); border-bottom: 1px solid var(--color-border-subtle); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 24px; }
.header-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 12px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-text-primary); }

/* Page Header */
.page-header { margin-bottom: 32px; }
.page-header h1 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; }
.page-header p { color: var(--color-text-secondary); }

/* Cards */
.card { background: var(--color-bg-secondary); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.card-action { font-size: 14px; color: var(--color-primary); font-weight: 500; }

/* Item Cards with Big Logo */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.item-card { background: var(--color-bg-secondary); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: all 0.2s; }
.item-card:hover { border-color: var(--color-primary); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.item-card-logo { width: 100%; height: 140px; background: var(--color-bg-tertiary); display: flex; align-items: center; justify-content: center; background-size: contain; background-position: center; background-repeat: no-repeat; }
.item-card-logo-placeholder { font-family: var(--font-display); font-size: 48px; font-weight: 700; color: var(--color-text-muted); }
.item-card-body { padding: 16px; }
.item-company { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin-bottom: 2px; }
.item-client { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 12px; }
.item-badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.item-progress { margin: 12px 0; }
.item-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.item-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--color-text-muted); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-subtle); }

/* Detail Page */
.detail-header { display: flex; gap: 24px; margin-bottom: 32px; align-items: flex-start; flex-wrap: wrap; }
.detail-logo { width: 120px; height: 120px; border-radius: var(--radius-lg); background: var(--color-bg-tertiary); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 36px; font-weight: 700; color: var(--color-text-muted); flex-shrink: 0; overflow: hidden; }
.detail-logo.has-logo { background: var(--color-bg-secondary); border: 1px solid var(--color-border-subtle); }
.detail-info { flex: 1; min-width: 200px; }
.detail-info h1 { font-family: var(--font-display); font-size: 28px; margin-bottom: 4px; }
.detail-info p { color: var(--color-text-secondary); margin-bottom: 12px; }
.detail-badges { display: flex; gap: 8px; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* Info Grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.info-item label { display: block; font-size: 11px; color: var(--color-text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.info-item span { font-size: 14px; }
.info-item a { color: var(--color-primary); }

/* Badges */
.badge, .status-badge, .tier-badge, .tag { display: inline-block; padding: 4px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; }
.status-badge { background: var(--color-bg-tertiary); }
.status-badge.noted { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.status-badge.demo-complete { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-badge.demo-sent { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.status-badge.active { background: rgba(34, 197, 94, 0.2); color: var(--color-success); }
.status-badge.paused { background: rgba(245, 158, 11, 0.2); color: var(--color-warning); }
.status-badge.completed { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-badge.open { background: rgba(239, 68, 68, 0.2); color: var(--color-error); }
.status-badge.in-progress { background: rgba(245, 158, 11, 0.2); color: var(--color-warning); }
.status-badge.resolved { background: rgba(34, 197, 94, 0.2); color: var(--color-success); }

.tier-badge { background: var(--color-bg-tertiary); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.tier-badge.watchfuleye { background: linear-gradient(135deg, #ffd700, #ffb347); color: #000; }
.tier-badge.farmer { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); color: #000; }
.tier-badge.bugcatcher { background: linear-gradient(135deg, #cd7f32, #b87333); color: #fff; }
.tier-badge.host { background: var(--color-bg-tertiary); color: var(--color-text-muted); }

.tag { background: var(--color-bg-tertiary); color: var(--color-text-secondary); font-size: 11px; }
.badge-secondary { background: var(--color-bg-tertiary); }
.badge-success { background: rgba(34, 197, 94, 0.2); color: var(--color-success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--color-warning); }

/* Progress Bar */
.progress-bar { height: 6px; background: var(--color-bg-tertiary); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), #a855f7); border-radius: 3px; transition: width 0.3s; }
.progress-header { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; color: var(--color-text-secondary); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--color-bg-secondary); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: 20px; display: flex; gap: 16px; align-items: center; }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.purple { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }
.stat-icon.orange { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.stat-icon.yellow { background: rgba(234, 179, 8, 0.2); color: #fbbf24; }
.stat-label { font-size: 13px; color: var(--color-text-secondary); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-md); font-weight: 500; font-size: 14px; transition: all 0.15s; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-bg-tertiary); color: var(--color-text-primary); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-bg-hover); }
.btn-success { background: var(--color-success); color: white; }
.btn-ghost { color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-bg-tertiary); color: var(--color-text-primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--color-text-secondary); }
.form-label.required::after { content: ' *'; color: var(--color-error); }
.form-input { width: 100%; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-bg-tertiary); color: var(--color-text-primary); font-size: 14px; font-family: var(--font-body); transition: border-color 0.15s; }
.form-input:focus { outline: none; border-color: var(--color-primary); }
.form-input::placeholder { color: var(--color-text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--color-bg-secondary); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal.large { max-width: 700px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--color-border-subtle); }
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--color-text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--color-text-primary); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--color-border-subtle); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--color-border-subtle); }
.table th { font-weight: 600; color: var(--color-text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:hover td { background: var(--color-bg-tertiary); }

/* Tickets */
.ticket-row { display: flex; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid var(--color-border-subtle); cursor: pointer; transition: background 0.15s; }
.ticket-row:hover { background: var(--color-bg-tertiary); }
.ticket-priority { width: 4px; height: 40px; border-radius: 2px; flex-shrink: 0; }
.ticket-priority.watchfuleye { background: linear-gradient(135deg, #ffd700, #ffb347); }
.ticket-priority.farmer { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); }
.ticket-priority.bugcatcher { background: linear-gradient(135deg, #cd7f32, #b87333); }
.ticket-priority.host { background: var(--color-text-muted); }
.ticket-info { flex: 1; min-width: 0; }
.ticket-title { font-weight: 600; margin-bottom: 4px; }
.ticket-meta { font-size: 13px; color: var(--color-text-muted); }
.ticket-badges { display: flex; gap: 8px; align-items: center; }

/* Messages */
.message { display: flex; gap: 12px; margin-bottom: 16px; }
.message.sent { flex-direction: row-reverse; }
.message-avatar { width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--color-primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.message-bubble { max-width: 70%; padding: 12px 16px; border-radius: 16px; background: var(--color-bg-tertiary); }
.message.sent .message-bubble { background: var(--color-primary); }
.message-sender { font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--color-text-secondary); }
.message.sent .message-sender { color: rgba(255,255,255,0.8); }
.message-text { line-height: 1.5; }
.message-time { font-size: 11px; color: var(--color-text-muted); margin-top: 4px; }
.message.sent .message-time { color: rgba(255,255,255,0.6); }

/* Milestones */
.milestone-list { display: flex; flex-direction: column; gap: 12px; }
.milestone-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--color-bg-tertiary); border-radius: var(--radius-md); }
.milestone-dot { width: 12px; height: 12px; border-radius: var(--radius-full); background: var(--color-border); flex-shrink: 0; margin-top: 4px; }
.milestone-item.completed .milestone-dot { background: var(--color-success); }
.milestone-item.current .milestone-dot { background: var(--color-primary); }
.milestone-content { flex: 1; }
.milestone-title { font-weight: 600; margin-bottom: 4px; }
.milestone-status { font-size: 12px; color: var(--color-text-muted); }
.milestone-status-select { padding: 4px 8px; font-size: 12px; width: auto; background: var(--color-bg-secondary); }

/* Invoices */
.invoice-item { display: flex; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid var(--color-border-subtle); }
.invoice-item:last-child { border-bottom: none; }
.invoice-info { flex: 1; }
.invoice-amount { font-size: 18px; font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--color-border-subtle); }
.tab { padding: 12px 20px; background: transparent; border: none; color: var(--color-text-secondary); cursor: pointer; font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; }
.tab:hover { color: var(--color-text-primary); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* Filter Bar */
.filter-bar { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }

/* Checkbox Items */
.checkbox-item { display: flex; align-items: center; gap: 8px; padding: 8px; cursor: pointer; border-radius: var(--radius-sm); }
.checkbox-item:hover { background: var(--color-bg-tertiary); }
.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary); }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }
.empty-state h3 { margin-bottom: 8px; color: var(--color-text-secondary); }

/* Confirm Modal */
.confirm-message { font-size: 16px; text-align: center; padding: 12px 0; }

/* Project Progress */
.project-progress { padding: 8px 0; }
.project-progress .progress-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 500; }

/* Utilities */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.flex { display: flex; }
.gap-sm { gap: 8px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--color-bg-primary) 0%, #1a1b2e 100%); }
.login-container { width: 100%; max-width: 400px; text-align: center; }
.login-header { margin-bottom: 32px; }
.login-logo { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; margin-bottom: 24px; }
.login-logo-icon { width: 40px; height: 40px; background: linear-gradient(135deg, var(--color-primary), #f97316); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.login-logo img { width: 40px; height: 40px; border-radius: var(--radius-md); }
.login-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: var(--color-text-secondary); }
.login-card { background: var(--color-bg-secondary); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: 32px; text-align: left; }
.login-footer { margin-top: 24px; font-size: 14px; color: var(--color-text-muted); }
.login-footer a { color: var(--color-primary); }

/* Sidebar Logo Image */
.sidebar-logo-img { width: 36px; height: 36px; border-radius: var(--radius-md); object-fit: contain; }
.login-logo-img { width: 40px; height: 40px; border-radius: var(--radius-md); object-fit: contain; }

/* Legacy tier names fallback */
.tier-badge.premium { background: linear-gradient(135deg, #ffd700, #ffb347); color: #000; }
.tier-badge.starter { background: linear-gradient(135deg, #cd7f32, #b87333); color: #fff; }
.tier-badge.basic { background: var(--color-bg-tertiary); color: var(--color-text-muted); }
.tier-badge.professional { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); color: #000; }
.tier-badge.enterprise { background: linear-gradient(135deg, #ffd700, #ffb347); color: #000; }
.ticket-priority.premium, .ticket-priority.enterprise { background: linear-gradient(135deg, #ffd700, #ffb347); }
.ticket-priority.professional { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); }
.ticket-priority.starter { background: linear-gradient(135deg, #cd7f32, #b87333); }
.ticket-priority.basic { background: var(--color-text-muted); }
