/**
 * RAPIDLAUNCH CLIENT PORTAL - APPLE-STYLE DESIGN
 */

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

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f7;
    --bg-hover: #f0f0f2;
    
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #8a8a8e;
    --text-link: #0066cc;
    
    --accent: #17617a;
    --accent-hover: #115566;
    --accent-light: rgba(23, 97, 122, 0.1);
    
    --success: #34c759;
    --success-light: rgba(52, 199, 89, 0.1);
    --warning: #ff9500;
    --warning-light: rgba(255, 149, 0, 0.1);
    --error: #ff3b30;
    --error-light: rgba(255, 59, 48, 0.1);
    --info: #007aff;
    --info-light: rgba(0, 122, 255, 0.1);
    
    --border: #e5e5e7;
    --border-hover: #d1d1d6;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, Consolas, monospace;
    
    --sidebar-width: 260px;
    
    --transition: all 0.2s ease;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.cl-layout { display: flex; min-height: 100vh; }

.cl-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
}

.cl-logo {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}
.cl-logo:hover { background: var(--bg-hover); }

.cl-logo { height: 150px; display: flex; align-items: center; }
.cl-logo img { height: 100%; width: auto; max-height: 150px; }

.cl-nav { padding: 12px; flex: 1; }

.cl-nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 16px 12px 8px;
}

.cl-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.cl-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.cl-nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

.cl-nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.cl-nav-badge {
    margin-left: auto;
    background: var(--error);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.cl-footer { padding: 12px; border-top: 1px solid var(--border); }

.cl-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--bg-primary);
    min-height: 100vh;
}

.cl-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.cl-header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.cl-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cl-notif-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.cl-notif-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.cl-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cl-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.cl-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.cl-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cl-content { padding: 32px; }

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; letter-spacing: -0.02em; }
.page-header p { color: var(--text-muted); font-size: 15px; }

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-body-no-padding { padding: 0; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px 20px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-tertiary); border-bottom: 1px solid var(--border); }
.data-table td { padding: 14px 20px; font-size: 14px; color: var(--text-secondary); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--bg-hover); }

.badge { display: inline-flex; padding: 4px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-primary { background: var(--accent-light); color: var(--accent); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-input, .form-select { width: 100%; padding: 10px 14px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 14px; color: var(--text-primary); transition: var(--transition); }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-input::placeholder { color: var(--text-muted); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    background: radial-gradient(circle, var(--stat-glow, transparent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }
.stat-card:nth-child(1) { --stat-glow: rgba(23,97,122,0.08); }
.stat-card:nth-child(2) { --stat-glow: rgba(52,199,89,0.08); }
.stat-card:nth-child(3) { --stat-glow: rgba(255,149,0,0.08); }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover .stat-icon { transform: scale(1.05); }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-primary { background: linear-gradient(135deg, rgba(23,97,122,0.15) 0%, rgba(23,97,122,0.08) 100%); color: var(--accent); box-shadow: 0 2px 8px rgba(23,97,122,0.1); }
.stat-icon-success { background: linear-gradient(135deg, rgba(52,199,89,0.15) 0%, rgba(52,199,89,0.08) 100%); color: var(--success); box-shadow: 0 2px 8px rgba(52,199,89,0.1); }
.stat-icon-warning { background: linear-gradient(135deg, rgba(255,149,0,0.15) 0%, rgba(255,149,0,0.08) 100%); color: var(--warning); box-shadow: 0 2px 8px rgba(255,149,0,0.1); }
.stat-icon-error { background: var(--error-light); color: var(--error); }

.stat-content { flex: 1; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.2; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.entity-info { display: flex; align-items: center; gap: 12px; }
.entity-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.entity-primary { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.entity-secondary { font-size: 12px; color: var(--text-muted); }

.empty-state { padding: 48px 24px; text-align: center; color: var(--text-muted); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }

a { color: var(--text-link); text-decoration: none; transition: var(--transition); }
a:hover { color: #004499; }

.grid { display: grid; gap: var(--space-lg); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1024px) { .grid-cols-2 { grid-template-columns: 1fr; } }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.text-muted { color: var(--text-muted); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }

.alert { padding: 14px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-error { background: var(--error-light); color: var(--error); }
.alert-info { background: var(--info-light); color: var(--info); }

.filter-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.search-filter-form { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }

.menu-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.menu-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-decoration: none;
    transition: var(--transition);
    display: block;
    box-shadow: var(--shadow-sm);
}

.menu-box:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.menu-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 12px;
}

.menu-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.menu-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.menu-count { font-size: 12px; color: var(--accent); font-weight: 600; }

/* Dashboard menu boxes — enhanced hover */
.menu-box {
    position: relative;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.menu-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.08), 0 0 0 1px var(--accent);
}
.menu-box .menu-icon {
    font-size: 24px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.menu-box:hover .menu-icon {
    transform: scale(1.15);
}

/* Card enter animation */
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.stats-grid > .stat-card,
.menu-row > .menu-box {
    animation: cardEnter 0.4s ease both;
}
.stats-grid > .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid > .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid > .stat-card:nth-child(3) { animation-delay: 0.15s; }

/* Refined empty state */
.empty-state {
    padding: 60px 24px;
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    display: block;
}
@keyframes float {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto 20px;
}

/* Site cards */
.sites-section { margin-top: 40px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.site-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.site-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 8px;
}
.site-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.site-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.site-badge.live     { background: var(--success-light); color: var(--success); }
.site-badge.building { background: var(--warning-light); color: var(--warning); }
.site-card-body {
    padding: 0 20px 16px;
}
.site-domain {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 6px;
    word-break: break-all;
}
.site-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.actions { display: flex; gap: 8px; }
.actions .btn { padding: 6px 12px; font-size: 13px; }

@media (max-width: 768px) {
    .cl-sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
    .cl-main { margin-left: 0; }
    .cl-content { padding: 16px; }
    .page-header h1 { font-size: 24px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.login-logo img { height: 90px; width: auto; max-width: 100%; }
.login-logo svg { height: 90px; width: auto; max-width: 100%; }
.login-logo span { font-size: 20px; font-weight: 700; color: var(--text-primary); }

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 32px;
}