/* =============================================
   SurveyKita - Admin Dashboard CSS
   ============================================= */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

a { color: #065adf; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px;
    background: #1a1d23;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2d3038;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    color: #065adf;
    font-weight: 700;
}

.sidebar-header .app-logo {
    max-width: 100%;
    height: auto;
    max-height: 40px;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #9ca3af;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: #2d3038;
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: #065adf;
    color: #fff;
    border-radius: 0;
}

.nav-icon { margin-right: 10px; font-size: 1.1rem; }

.nav-divider { border: none; border-top: 1px solid #2d3038; margin: 10px 0; }

.nav-logout { color: #ef4444; }

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #2d3038;
    font-size: 0.8rem;
    color: #6b7280;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 20px 30px;
    min-height: 100vh;
}

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

.page-header h1 {
    font-size: 1.6rem;
    color: #1a1d23;
}

.header-right { display: flex; align-items: center; gap: 15px; }

.user-badge {
    background: #eef2ff;
    color: #065adf;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eef;
}

.card-header h3 { font-size: 1.1rem; color: #1a1d23; }

.card-body { padding: 20px; }

.card-body.p-0 { padding: 0; }

.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-icon { font-size: 2rem; }

.stat-body h3 { font-size: 1.8rem; margin: 0; line-height: 1.2; }
.stat-body p { color: #666; margin: 5px 0 0; font-size: 0.85rem; }

.stat-blue .stat-body h3 { color: #065adf; }
.stat-green .stat-body h3 { color: #10b981; }
.stat-purple .stat-body h3 { color: #8b5cf6; }
.stat-orange .stat-body h3 { color: #f59e0b; }

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .charts-row { grid-template-columns: 1fr; }
}

.chart-card .card-body { padding: 15px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }

.table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    border-bottom: 2px solid #eef;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table tr:hover td { background: #f8faff; }

.td-title { max-width: 250px; }
.td-actions { white-space: nowrap; }

.table-total td { background: #f0f4ff; font-weight: bold; }

.table-detail td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.table-detail td:first-child {
    font-weight: 600;
    color: #666;
    width: 150px;
}

.table-sm td, .table-sm th { padding: 6px 10px; font-size: 0.9rem; }

/* Top Surveys */
.top-surveys { padding: 5px 0; }

.top-survey-item { margin-bottom: 15px; }

.top-survey-name {
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.top-survey-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-fill {
    height: 24px;
    background: linear-gradient(90deg, #065adf, #4d8bf4);
    border-radius: 4px;
    transition: width 0.5s;
    min-width: 4px;
}

.bar-label { font-size: 0.85rem; color: #666; white-space: nowrap; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; opacity: 0.9; }

.btn-primary { background: #065adf; color: #fff; border-color: #065adf; }
.btn-primary:hover { background: #054bbd; }

.btn-success { background: #10b981; color: #fff; border-color: #10b981; }
.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-info { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.btn-secondary { background: #6b7280; color: #fff; border-color: #6b7280; }

.btn-outline {
    background: transparent;
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline:hover { background: #f3f4f6; }

.btn-sm { padding: 4px 10px; font-size: 0.85rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { display: block; width: 100%; }

/* Forms */
.form-group { margin-bottom: 15px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #065adf;
    box-shadow: 0 0 0 3px rgba(6, 90, 223, 0.1);
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; }

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .col { flex: 1; }

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check label { cursor: pointer; }

.form-actions { margin-top: 20px; }

.filter-form .filter-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form .form-control { width: auto; min-width: 200px; }

/* Alerts */
.alert {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #e5e7eb; color: #374151; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: #eef2ff; color: #065adf; }

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 20px 0;
}

.page-link {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
}

.page-link.active { background: #065adf; color: #fff; border-color: #065adf; }
.page-link:hover { background: #f3f4f6; text-decoration: none; }

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #065adf 0%, #4d8bf4 100%);
}

.auth-container { width: 100%; max-width: 400px; padding: 20px; }

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-logo { text-align: center; margin-bottom: 30px; }

.auth-logo h1 {
    color: #065adf;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.auth-logo p { color: #666; font-size: 0.9rem; }

.auth-form .form-group { margin-bottom: 20px; }

.auth-footer { text-align: center; margin-top: 25px; color: #999; }

/* Question List */
.question-list {
    padding-left: 20px;
}

.question-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.question-item:last-child { border-bottom: none; }

.q-text { font-weight: 500; margin-bottom: 4px; }
.q-meta { font-size: 0.85rem; color: #666; }

.required { color: #ef4444; }

/* Text Utilities */
.text-muted { color: #6b7280; }
.text-center { text-align: center; }
.py-4 { padding-top: 20px; padding-bottom: 20px; }
.p-3 { padding: 15px; }
.p-0 { padding: 0; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 20px; }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; overflow: hidden; }
    .sidebar-header h2, .sidebar-header p, .nav-item span:not(.nav-icon), .sidebar-footer { display: none; }
    .nav-item { justify-content: center; padding: 15px; }
    .nav-icon { margin-right: 0; font-size: 1.3rem; }
    .main-content { margin-left: 60px; padding: 15px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .charts-row { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
