/* Variables */
:root {
    --primary-color: #10b77f;
    --primary-dark: #0ea06f;
    --secondary-color: #1f6be6;
    --bg-light: #f7f7f7;
    --bg-white: #ffffff;
    --text-dark: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --sidebar-width: 260px;
    --header-height: 70px;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.08);
    --radius-md: 12px;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-section {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin: 1.5rem 0 0.5rem 1rem;
}

.nav-section:first-child {
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.2rem;
    transition: all 0.2s;
    gap: 0.8rem;
}

.nav-item i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}

.nav-item:hover {
    background-color: rgba(16, 183, 127, 0.08);
    color: var(--primary-color);
}

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

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

.nav-item.active i {
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.nav-item.logout {
    color: #e53935;
}

.nav-item.logout:hover {
    background-color: #ffebee;
    color: #c62828;
}

.nav-item.logout i {
    color: #e53935;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #f0f0f0;
    color: var(--primary-color);
}

.page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline {
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    background: white;
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-profile:hover {
    background: #f0f0f0;
}

.user-info {
    text-align: right;
    display: none;
}

@media (min-width: 768px) {
    .user-info {
        display: flex;
        flex-direction: column;
    }
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
    display: none;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.user-profile.active .profile-dropdown {
    display: block;
    animation: slideDown 0.2s ease;
}

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

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

.dropdown-header {
    padding: 1.5rem;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-avatar img,
.dropdown-avatar .avatar-placeholder {
    width: 50px;
    height: 50px;
}

.dropdown-user-details {
    display: flex;
    flex-direction: column;
}

.dropdown-menu {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-menu li a:hover {
    background: #f5f5f5;
    color: var(--primary-color);
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Content */
.content-wrapper {
    padding: 2rem;
}

/* Dashboard Widgets */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.widget-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.2s;
}

.widget-card:hover {
    transform: translateY(-5px);
}

.widget-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.widget-info h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.widget-value {
    margin: 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
}

.widget-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
}

.widget-trend.positive {
    color: #10b77f;
}

.widget-trend.negative {
    color: #e53935;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

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

.card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.badge {
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-warning {
    background: #fff3e0;
    color: #f57c00;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}

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

.action-btn i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        /* Full width on mobile */
        max-width: 300px;
    }

    .admin-container.sidebar-collapsed .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
        /* Shadow for overlay feel */
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .admin-container.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .top-header {
        padding: 0 1rem;
    }

    .header-right .btn-outline {
        display: none;
        /* Hide View Site button on mobile */
    }

    .user-info {
        display: none;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

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

    .table-responsive {
        overflow-x: auto;
    }

    /* Icon-only buttons on mobile */
    .btn {
        font-size: 0 !important;
        padding: 0.6rem;
        justify-content: center;
        width: 40px;
        /* Optional: Make them square-ish if desired, or let them auto-width */
    }

    .btn i {
        font-size: 1.2rem !important;
        margin: 0 !important;
    }

    /* Exception: If we really need text on some buttons, we can add a specific class */
}

/* Desktop Collapsed */
@media (min-width: 769px) {
    .admin-container.sidebar-collapsed .sidebar {
        width: 70px;
    }

    .admin-container.sidebar-collapsed .logo span,
    .admin-container.sidebar-collapsed .nav-section,
    .admin-container.sidebar-collapsed .nav-item span,
    .admin-container.sidebar-collapsed .sidebar-footer span {
        display: none;
    }

    .admin-container.sidebar-collapsed .sidebar-header {
        justify-content: center;
        padding: 0;
    }

    .admin-container.sidebar-collapsed .nav-item {
        justify-content: center;
        padding: 1rem 0;
    }

    .admin-container.sidebar-collapsed .nav-item i {
        font-size: 1.2rem;
    }

    .admin-container.sidebar-collapsed .main-content {
        margin-left: 70px;
    }
}

/* Form Styling */
.form-card {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 183, 127, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: #e53935;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c62828;
}

.invalid-feedback {
    color: #e53935;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Delete Card */
.delete-card {
    max-width: 500px;
    margin: 2rem auto;
}

.warning-icon {
    font-size: 4rem;
    color: #ff9800;
    margin-bottom: 1rem;
}

.delete-card h3 {
    margin-bottom: 1rem;
}

.delete-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-actions.centered {
    justify-content: center;
}

/* Table Actions */
.actions-cell {
    white-space: nowrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: var(--text-muted);
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.btn-icon:hover {
    background: #f0f0f0;
    color: var(--primary-color);
}

.btn-icon.delete:hover {
    background: #ffebee;
    color: #e53935;
}

/* Search Form */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    width: 100%;
}

.search-input {
    position: relative;
    min-width: 250px;
}

.search-input i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: #f9f9f9;
    box-sizing: border-box;
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(16, 183, 127, 0.1);
}

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

.form-select {
    width: 100%;
    padding: 0.6rem 2rem 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: all 0.2s;
}

.form-select:hover {
    border-color: #b0b0b0;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 183, 127, 0.1);
}

.btn-secondary {
    background: var(--text-dark);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: black;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

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

    .search-input,
    .filter-group {
        width: 100%;
        min-width: 0;
    }
}

/* Pagination */
.pagination {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.step-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.step-links a {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s;
}

.step-links a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.step-links .current {
    padding: 0.5rem 1rem;
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.btn-link:hover {
    color: var(--primary-dark);
}
/* Toggle Switch */
.toggle-filter {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #f8f9fa;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Date Range Filter */
.date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.date-range input {
    border: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--text-dark);
    padding: 0;
    width: auto;
}

.date-range input:focus {
    outline: none;
    box-shadow: none;
}

.date-range span {
    color: var(--text-muted);
    font-size: 0.8rem;
}
