/**
 * UIU Survey System - Admin Panel Styles
 * Mobile-first responsive design
 */

/* Admin Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 250px;
    background: var(--primary-dark);
    color: white;
    position: fixed;
    top: 0;
    left: -250px;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.admin-sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.sidebar-header h2 {
    color: white;
    font-size: 1.125rem;
    margin: 0;
}

.sidebar-header p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin: 5px 0 0 0;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9375rem;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav a.active {
    background: var(--secondary-color);
    color: white;
}

.sidebar-nav a svg,
.sidebar-nav a i {
    width: 20px;
    flex-shrink: 0;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 20px;
}

.sidebar-section-title {
    padding: 15px 20px 10px;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

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

/* Admin Header */
.admin-header {
    background: var(--bg-white);
    padding: 15px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--border-color);
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

.admin-header-title {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.admin-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
}

.admin-user-role {
    font-size: 0.6875rem;
    color: var(--text-muted);
    display: none;
}

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

/* Admin Content */
.admin-content {
    flex: 1;
    padding: 20px;
    background: var(--bg-color);
}

/* Page Header */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.orange {
    background: #fef3c7;
    color: var(--secondary-color);
}

.stat-icon.green {
    background: #d1fae5;
    color: var(--success-color);
}

.stat-icon.yellow {
    background: #fef3c7;
    color: var(--warning-color);
}

.stat-icon.red {
    background: #fee2e2;
    color: var(--error-color);
}

.stat-content h3 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-color);
}

.stat-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* Admin Cards */
.admin-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.admin-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-card-header h2 {
    font-size: 1.125rem;
    margin: 0;
}

.admin-card-body {
    padding: 20px;
}

.admin-card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

/* Admin Tables */
.admin-table {
    width: 100%;
    font-size: 0.875rem;
}

.admin-table th {
    background: var(--bg-color);
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table tr:hover {
    background: var(--bg-color);
}

.admin-table .actions {
    white-space: nowrap;
}

.admin-table .actions a,
.admin-table .actions button {
    padding: 6px 10px;
    font-size: 0.75rem;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: var(--primary-dark);
    color: white;
    padding: 30px;
    text-align: center;
}

.login-header h1 {
    color: white;
    font-size: 1.5rem;
    margin: 0 0 5px 0;
}

.login-header p {
    opacity: 0.9;
    margin: 0;
    font-size: 0.875rem;
}

.login-body {
    padding: 30px;
}

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

.login-body .btn {
    width: 100%;
    margin-top: 10px;
}

.login-footer {
    padding: 15px 30px;
    background: var(--bg-color);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Filters */
.filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* Response Detail */
.response-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.response-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.response-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.response-meta-item strong {
    color: var(--text-muted);
}

.response-section {
    margin-bottom: 20px;
}

.response-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.response-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.response-question {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 5px;
    font-size: 0.9375rem;
}

.response-answer {
    color: var(--text-light);
    font-size: 0.875rem;
    line-height: 1.5;
}

.response-answer.highlight {
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* User Management */
.user-table .role-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.role-badge.super_admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.admin {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 0.9375rem;
    margin-bottom: 20px;
}

/* Responsive - Tablet */
@media (min-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
    }

    .filter-group {
        flex: 1;
        min-width: 150px;
    }

    .admin-user-name,
    .admin-user-role {
        display: block;
    }
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Desktop - Show sidebar */
@media (min-width: 992px) {
    .admin-sidebar {
        left: 0;
    }

    .admin-main {
        margin-left: 250px;
    }

    .menu-toggle {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .admin-content {
        padding: 30px;
    }
}

@media (min-width: 1200px) {
    .admin-card-body {
        padding: 25px;
    }
}

/* Print */
@media print {
    .admin-sidebar,
    .admin-header,
    .page-header-actions,
    .filters,
    .actions,
    .modal {
        display: none !important;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-content {
        padding: 0;
    }

    .admin-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
