/* SaaS Dashboard Styles - Professional Light Theme */
:root {
    --bg-app: #f1f5f9;
    --bg-panel: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --primary: #4f46e5; /* Indigo */
    --primary-hover: #4338ca;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body.dashboard-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden; /* App layout, scroll only in main content */
}

.layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo { height: 28px; margin-right: 12px; }
.sidebar-title { color: #fff; font-weight: 600; font-size: 18px; letter-spacing: 1px; }

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-group {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-left: 12px;
    color: rgba(148, 163, 184, 0.5);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 15px;
}

.nav-item i { margin-right: 12px; font-size: 20px; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4); }

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.05); }
.back-link { color: var(--sidebar-text); text-decoration: none; font-size: 14px; display: flex; align-items: center; }
.back-link i { margin-right: 8px; }
.back-link:hover { color: #fff; }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.breadcrumb { display: flex; align-items: center; font-size: 14px; color: var(--text-muted); }
.breadcrumb i { margin: 0 8px; }
.breadcrumb .current { color: var(--text-main); font-weight: 500; }

.user-actions { display: flex; align-items: center; gap: 24px; }
.icon-btn { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; position: relative; }
.icon-btn .badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: white; font-size: 10px; padding: 2px 4px; border-radius: 10px; border: 2px solid #fff; }

.user-profile { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-main); font-weight: 500; cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: background 0.2s; }
.user-profile:hover { background: #f8fafc; }
.avatar { width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }

/* Role Dropdown */
.dropdown-trigger { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 200px; display: none; flex-direction: column; padding: 8px 0; z-index: 100; }
.dropdown-menu::before { content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px; background: transparent; }
.dropdown-trigger:hover .dropdown-menu { display: flex; }
.dropdown-item { padding: 10px 16px; font-size: 14px; color: var(--text-main); cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 8px; }
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-item.active { color: var(--primary); font-weight: 500; background: #e0e7ff; }

.page-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

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

.page-title { font-size: 24px; font-weight: 600; color: #0f172a; }

/* Animations */
.fade-in { animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Common Components */
.btn {
    padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.panel-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

/* Admin View */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 24px; }
.stat-card { background: #fff; padding: 24px; border-radius: 12px; border: 1px solid var(--border); display: flex; align-items: center; gap: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.stat-icon { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.stat-icon.purple { background: #e0e7ff; color: var(--primary); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.blue { background: #dbeafe; color: #3b82f6; }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-info h3 { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--text-main); }

.panel-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.panel-header h2 { font-size: 16px; font-weight: 600; }
.panel-actions { display: flex; gap: 12px; align-items: center; }

.search-box { position: relative; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input { padding: 8px 12px 8px 36px; border: 1px solid var(--border); border-radius: 6px; outline: none; width: 220px; font-size: 14px; transition: all 0.2s; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); width: 260px; }

.filter-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; font-size: 14px; color: var(--text-main); cursor: pointer; background: #fff; }

.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.data-table th, .data-table td { padding: 16px 24px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-weight: 500; color: var(--text-muted); font-size: 13px; background: #f8fafc; }
.data-table td { font-size: 14px; }
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: #f8fafc; }

.thumb-placeholder { width: 48px; height: 36px; background: #e2e8f0; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 18px; }
.thumb-placeholder.empty { background: #f1f5f9; border: 1px dashed #cbd5e1; }
.work-title { font-weight: 500; color: var(--text-main); }

.progress-wrapper { display: flex; align-items: center; gap: 12px; }
.progress-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; min-width: 60px;}
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; }
.progress-text { font-size: 12px; color: var(--text-muted); width: 32px; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; display: inline-block; text-align: center;}
.status-warning { background: #fef3c7; color: #d97706; }
.status-success { background: #d1fae5; color: #059669; }
.status-draft { background: #f1f5f9; color: #475569; }

.action-btn { background: none; border: none; color: var(--primary); font-size: 14px; font-weight: 500; cursor: pointer; }
.action-btn:hover { text-decoration: underline; }
.action-btn.disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }

.pagination { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 14px; }
.page-controls { display: flex; gap: 4px; align-items: center; }
.page-btn { min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; color: var(--text-main); transition: all 0.2s;}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* User View */
.stepper-container { display: flex; align-items: center; justify-content: center; margin-bottom: 40px; padding: 24px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 140px; cursor: pointer; }
.step-icon { width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 2px solid var(--border); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; z-index: 2; transition: all 0.3s; }
.step.active .step-icon { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }
.step.completed .step-icon { border-color: var(--success); background: var(--success); color: #fff; }
.step span { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.step.active span, .step.completed span { color: var(--text-main); }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 -40px; margin-bottom: 24px; z-index: 1; transition: background 0.3s; }
.step-line.active { background: var(--success); }

.form-container { padding: 40px; max-width: 900px; margin: 0 auto; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 24px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-info { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.alert-info i { color: #3b82f6; font-size: 18px; }

.form-section-title { font-size: 18px; font-weight: 600; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--text-main); }
.required { color: var(--danger); }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; outline: none; font-family: inherit; transition: border-color 0.2s; color: var(--text-main); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
textarea.form-control { resize: vertical; line-height: 1.5; }

.form-tip { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5;}
.upload-dropzone { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 40px; text-align: center; cursor: pointer; transition: all 0.3s; background: #f8fafc; margin-bottom: 24px; }
.upload-dropzone:hover, .upload-dropzone.dragover { border-color: var(--primary); background: #eef2ff; }
.dropzone-icon { font-size: 40px; color: var(--primary); margin-bottom: 16px; opacity: 0.8; transition: transform 0.3s;}
.upload-dropzone:hover .dropzone-icon { transform: translateY(-5px); }
.upload-dropzone h3 { font-size: 16px; font-weight: 500; margin-bottom: 8px; color: var(--text-main); }
.upload-dropzone p { font-size: 13px; color: var(--text-muted); }

.uploaded-files { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.file-item { display: flex; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; transition: box-shadow 0.2s;}
.file-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.file-icon { font-size: 24px; color: var(--text-muted); margin-right: 16px; }
.file-item:nth-child(1) .file-icon { color: #3b82f6; }
.file-item.uploading .file-icon { color: var(--primary); }
.file-details { flex: 1; }
.file-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; color: var(--text-main);}
.file-size { font-size: 12px; color: var(--text-muted); }
.upload-progress-bar { height: 4px; background: #e2e8f0; border-radius: 2px; margin-top: 8px; width: 80%; overflow: hidden;}
.upload-progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.3s; }
.file-status { font-size: 13px; margin: 0 24px; color: var(--text-muted);}
.text-success { color: var(--success); }
.btn-icon { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; transition: color 0.2s;}
.btn-icon:hover { color: var(--danger); }

.form-actions { display: flex; justify-content: flex-end; gap: 16px; padding-top: 24px; border-top: 1px solid var(--border); }

/* Step interaction */
.step-btn { cursor: pointer; transition: transform 0.2s; }
.step-btn:hover { transform: translateY(-3px); }
.step-btn:hover .step-icon { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }
.step-content { animation: fadeIn 0.4s ease-in-out; }

/* Segmented Control */
.segmented-control { display: flex; background: #f1f5f9; padding: 4px; border-radius: 8px; margin-bottom: 24px; width: fit-content; }
.segment-btn { padding: 8px 32px; border: none; background: transparent; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.segment-btn.active { background: #e0e7ff; color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* Dynamic Tabs */
.dynamic-tabs { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.d-tab { padding: 8px 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; color: var(--text-muted); }
.d-tab.active { background: #e0e7ff; border-color: #c7d2fe; color: var(--primary); font-weight: 500; }
.d-tab-add { padding: 8px 12px; background: transparent; border: 1px dashed #cbd5e1; color: var(--primary); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: all 0.2s; }
.d-tab-add:hover { border-color: var(--primary); background: #f5f3ff; }
.d-tab .del-icon { color: var(--text-muted); font-size: 14px; margin-left: 4px; }
.d-tab .del-icon:hover { color: var(--danger); }

/* Legal text */
.legal-text h4 { font-size: 15px; color: var(--text-main); margin-bottom: 12px; margin-top: 24px; }
.legal-text h4:first-child { margin-top: 0; }
.legal-text p { font-size: 14px; color: var(--text-muted); line-height: 1.7; }

/* Step 3 Horizontal Form Layout */
.row-group { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.label-fixed { width: 100px; flex-shrink: 0; padding-top: 8px; font-weight: 500; color: var(--text-main); font-size: 14px; }

.input-with-counter { position: relative; flex: 1; display: flex; align-items: center; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; }
.input-with-counter input { border: none; background: transparent; padding-right: 50px; flex: 1; }
.input-with-counter input:focus { box-shadow: none; }
.char-count { position: absolute; right: 12px; font-size: 12px; color: var(--text-muted); }

/* Rich Text Editor Mock */
.rich-text-editor { flex: 1; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; background: #f8fafc; }
.editor-toolbar { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); gap: 4px; flex-wrap: wrap; background: #fff; }
.editor-toolbar button { background: none; border: none; padding: 6px; border-radius: 4px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.editor-toolbar button:hover { background: #f1f5f9; color: var(--text-main); }
.editor-select { border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; font-size: 13px; color: var(--text-main); outline: none; }
.toolbar-divider { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.editor-content { min-height: 200px; padding: 16px; border: none; resize: vertical; background: #fff; flex: 1; font-size: 14px; line-height: 1.6; color: var(--text-main); outline: none; }
.editor-footer { padding: 8px 16px; text-align: right; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); background: #fff; }

/* Tag Inputs */
.tag-inputs { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Upload Section */
.upload-section { margin-bottom: 32px; display: flex; flex-direction: column; gap: 12px; }
.upload-header { display: flex; gap: 16px; align-items: flex-start; }
.upload-header label { width: 100px; flex-shrink: 0; font-weight: 500; font-size: 14px; color: var(--text-main); }
.upload-tip { flex: 1; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.square-upload-box { width: 100px; height: 100px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; font-size: 32px; color: #a78bfa; margin-left: 116px; }
.square-upload-box:hover { border-color: var(--primary); background: #f5f3ff; color: var(--primary); }

/* Custom Radio */
.radio-group { flex: 1; display: flex; gap: 24px; align-items: center; height: 36px; }
.radio-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-main); cursor: pointer; }
.radio-label input { display: none; }
.radio-custom { width: 16px; height: 16px; border: 1px solid #cbd5e1; border-radius: 50%; display: inline-block; position: relative; transition: all 0.2s; }
.radio-label input:checked + .radio-custom { border-color: var(--primary); }
.radio-label input:checked + .radio-custom::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 8px; height: 8px; background: var(--primary); border-radius: 50%; }

/* Blockchain Animation */
.chain-spinner { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 3px solid #f1f5f9; border-top-color: var(--primary); border-right-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile Responsiveness */
.mobile-back-btn { display: none; text-decoration: none; font-weight: 500; }

@media (max-width: 768px) {
    /* Hide sidebar and show mobile back button */
    .sidebar { display: none; }
    .mobile-back-btn { display: flex; align-items: center; gap: 4px; color: var(--text-main); }
    .hide-mobile { display: none !important; }
    
    /* Topbar and Page Header */
    .topbar { padding: 0 16px; height: 56px; }
    .user-profile span { display: none; }
    .page-container { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .view-switcher { width: 100%; display: flex; }
    .switch-btn { flex: 1; justify-content: center; padding: 10px 8px; font-size: 13px; }
    
    /* B-End Admin View */
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 16px; gap: 12px; flex-direction: column; text-align: center; align-items: center; }
    .stat-icon { width: 48px; height: 48px; font-size: 24px; }
    
    .panel-header { flex-direction: column; align-items: flex-start; gap: 16px; padding: 16px; }
    .panel-actions { flex-direction: column; width: 100%; align-items: stretch; gap: 12px; }
    .search-box input { width: 100%; }
    .search-box input:focus { width: 100%; }
    .pagination { flex-direction: column; gap: 16px; align-items: center; }
    
    /* C-End User View */
    .stepper-container { padding: 16px 0; overflow-x: auto; justify-content: flex-start; margin-bottom: 24px; }
    .step { min-width: 100px; width: 100px; }
    .step-line { min-width: 40px; margin: 0 -20px; margin-bottom: 24px; }
    
    .form-container { padding: 16px; border-radius: 8px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .upload-dropzone { padding: 24px 16px; }
    
    .form-actions { flex-direction: column; gap: 12px; }
    .form-actions .btn { width: 100%; justify-content: center; padding: 12px; }
    
    .file-item { flex-direction: column; align-items: flex-start; gap: 12px; position: relative; }
    .file-item .btn-icon { position: absolute; top: 16px; right: 16px; }
    .file-status { margin: 0; }
}
