.admin-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.back-link {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.back-link:hover {
    text-decoration: underline;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--background);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-icon {
    font-size: 1.125rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-footer p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    background: var(--background);
    min-height: 100vh;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    margin-bottom: 32px;
}

.section-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    border-radius: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

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

.dashboard-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-content {
    padding: 20px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    padding: 6px 12px;
    background: var(--background);
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.tag-item:hover {
    background: var(--primary-color);
    color: white;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.recent-item:last-child {
    margin-bottom: 0;
}

.recent-item:hover {
    background: var(--border-color);
}

.recent-info {
    flex: 1;
    overflow: hidden;
}

.recent-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-box .form-input {
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group .form-input {
    width: auto;
    min-width: 140px;
}

.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
}

.data-table th {
    background: var(--background);
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--background);
}

.table-title {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.table-tag {
    padding: 2px 8px;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    font-size: 0.8125rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--background);
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.action-btn.delete:hover {
    background: var(--danger-color);
    color: white;
}

.media-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.media-item {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.media-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.media-preview {
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--background);
}

.media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-info {
    padding: 12px;
}

.media-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.media-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

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

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.status-label {
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

.status-checking {
    background: #fef3c7;
    color: #92400e;
}

.status-ok {
    background: #dcfce7;
    color: #166534;
}

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

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.config-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.config-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-actions .btn {
    padding: 10px 20px;
}

.admin-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    z-index: 1001;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.admin-notification.success {
    background: var(--success-color);
}

.admin-notification.error {
    background: var(--danger-color);
}

.admin-notification.info {
    background: var(--primary-color);
}

.admin-notification.hidden {
    display: none;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    padding: 24px;
}

.empty-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    padding: 40px 20px;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .admin-main {
        margin-left: 0;
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }
}

@media (prefers-color-scheme: dark) {
    .sidebar {
        background: #1e293b;
        border-color: #334155;
    }

    .sidebar-header {
        border-color: #334155;
    }

    .sidebar-footer {
        border-color: #334155;
    }

    .nav-item:hover {
        background: #334155;
    }

    .stat-card,
    .dashboard-card,
    .table-container,
    .media-item {
        background: #1e293b;
    }

    .recent-item {
        background: #334155;
    }
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-box {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.login-box h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-box>p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-box .form-input {
    width: 100%;
    margin-bottom: 12px;
    text-align: center;
    font-size: 1rem;
    padding: 14px;
}

.login-box .error-text {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.login-box .btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    margin-bottom: 16px;
}

.login-box .back-link {
    display: block;
    font-size: 0.875rem;
}