/* Module Pages Styles */

/* Main Content Area */
.module-content {
    margin-left: 280px;
    padding: 2rem 0;
    transition: margin-left 0.3s ease;
}

@media (max-width: 768px) {
    .module-content {
        margin-left: 0;
    }
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 2.2rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #666;
    font-size: 1rem;
}

/* Module Toolbar */
.module-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Statistics Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-size: 0.95rem;
}

/* Module Table */
.module-table-wrapper {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.module-table {
    width: 100%;
    border-collapse: collapse;
}

.module-table thead {
    background: var(--light-color);
    border-bottom: 2px solid var(--border-color);
}

.module-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
}

.module-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: #333;
}

.module-table tbody tr:hover {
    background: var(--light-color);
    cursor: pointer;
}

.module-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Form Elements */
.module-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Cards Layout */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    color: #666;
    line-height: 1.6;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .module-content {
        margin-left: 250px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .module-table {
        font-size: 0.9rem;
    }

    .module-table th,
    .module-table td {
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    .module-content {
        margin-left: 0;
        padding: 1rem 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .module-toolbar {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .module-table {
        font-size: 0.85rem;
    }

    .module-table th,
    .module-table td {
        padding: 0.5rem;
    }

    .module-form {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.2rem;
    }

    .module-toolbar {
        gap: 0.5rem;
    }

    .btn {
        flex: 1;
    }

    .search-box {
        min-width: 100%;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .module-table {
        font-size: 0.75rem;
    }

    .module-table th,
    .module-table td {
        padding: 0.4rem;
    }

    .badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .btn-small {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .module-toolbar,
    .sidebar-overlay {
        display: none;
    }

    .module-content {
        margin-left: 0;
    }

    .module-table {
        border-collapse: collapse;
    }
}

/* ============================================================
   Admin user pill (top-right of the module navbar)
   ============================================================ */
.admin-user-pill {
    position: relative;
    margin-left: auto;
}
.admin-user-pill .aup-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 999px;
    padding: 5px 12px 5px 5px;
    cursor: pointer;
    font: inherit;
    color: #0f172a;
    box-shadow: 0 2px 6px -1px rgba(15, 23, 42, 0.06);
    transition: all .2s;
}
.admin-user-pill .aup-trigger:hover {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-color: #0a6cdb;
    box-shadow: 0 4px 12px -2px rgba(10, 108, 219, 0.18);
}
.admin-user-pill .aup-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0a6cdb, #0a4faf);
    color: #fff;
    font-weight: 800; font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(10, 108, 219, 0.35);
    flex-shrink: 0;
}
.admin-user-pill .aup-meta {
    display: flex; flex-direction: column; align-items: flex-start;
    line-height: 1.2;
    padding-right: 4px;
}
.admin-user-pill .aup-name {
    font-weight: 700; font-size: 0.88rem;
    color: #0f172a;
    max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-user-pill .aup-role {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-user-pill .aup-caret {
    color: #94a3b8;
    font-size: 0.8rem;
    margin-right: 2px;
    transition: transform .2s;
}
.admin-user-pill.open .aup-caret { transform: rotate(180deg); }

.admin-user-pill .aup-menu {
    position: absolute;
    right: 0; top: calc(100% + 8px);
    min-width: 200px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.18), 0 4px 8px rgba(15, 23, 42, 0.06);
    padding: 8px;
    display: none;
    z-index: 200;
}
.admin-user-pill.open .aup-menu { display: block; }
.admin-user-pill .aup-menu a {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: #0f172a;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background .15s, color .15s;
}
.admin-user-pill .aup-menu a:hover {
    background: rgba(10, 108, 219, 0.08);
    color: #0a6cdb;
}
.admin-user-pill .aup-menu a.danger { color: #b91c1c; }
.admin-user-pill .aup-menu a.danger:hover { background: rgba(220, 38, 38, 0.08); }
.admin-user-pill .aup-menu hr {
    margin: 6px 4px;
    border: 0; border-top: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .admin-user-pill .aup-meta { display: none; }
    .admin-user-pill .aup-trigger { padding: 4px 10px 4px 4px; gap: 0.4rem; }
    .admin-user-pill .aup-caret { display: none; }
}
