/* =============================================================
   pipl-shared.css — Common UI styles shared across all views
   Extracted from _AgGridStyles.cshtml and common view patterns
   ============================================================= */

/* ── CSS custom properties ────────────────────────────────── */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --info-gradient: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    --warning-gradient: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    --danger-gradient: linear-gradient(135deg, #cb2d3e 0%, #ef473a 100%);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

/* ── Page header ──────────────────────────────────────────── */
.page-header-modern {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
}

.page-header-modern h1 {
    margin: 0;
    font-weight: 600;
    font-size: 1.75rem;
}

.page-header-modern .breadcrumb {
    background: transparent;
    margin: 0;
    padding: 0;
}

.page-header-modern .breadcrumb-item,
.page-header-modern .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.8);
}

.page-header-modern .breadcrumb-item.active {
    color: white;
}

/* ── Modern card ──────────────────────────────────────────── */
.card-modern {
    border: none;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.card-modern .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
}

.card-modern .card-body {
    padding: 1.5rem;
}

/* ── Action buttons ───────────────────────────────────────── */
.btn-create {
    background: var(--success-gradient);
    border: none;
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.btn-create:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
    color: white;
}

.btn-export {
    background: var(--info-gradient);
    border: none;
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(33, 147, 176, 0.3);
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 147, 176, 0.4);
    color: white;
}

.btn-refresh {
    background: var(--warning-gradient);
    border: none;
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(247, 151, 30, 0.3);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(247, 151, 30, 0.4);
    color: white;
}

/* ── AG Grid theme overrides ──────────────────────────────── */
.ag-theme-alpine {
    --ag-header-background-color: #f8f9fa;
    --ag-header-foreground-color: #495057;
    --ag-row-hover-color: #e3f2fd;
    --ag-selected-row-background-color: #bbdefb;
    --ag-font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --ag-font-size: 14px;
    --ag-grid-size: 6px;
    --ag-borders: none;
    --ag-border-radius: 8px;
    border-radius: 12px;
    overflow: hidden;
}

.ag-theme-alpine .ag-header-cell {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.ag-theme-alpine .ag-cell {
    display: flex;
    align-items: center;
}

.ag-theme-alpine .ag-paging-panel {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.ag-theme-alpine .ag-paging-panel .ag-paging-button,
.ag-theme-alpine .ag-paging-panel .ag-icon,
.ag-theme-alpine .ag-paging-panel .ag-pagination-number {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #495057 !important;
}

.ag-theme-alpine .ag-paging-panel .ag-paging-button {
    background: transparent !important;
    border: none !important;
    padding: .25rem .5rem !important;
    cursor: pointer !important;
}

.ag-theme-alpine .ag-paging-panel .ag-paging-button-disabled {
    opacity: .45 !important;
    cursor: default !important;
}

.ag-theme-alpine .ag-paging-panel .ag-icon svg {
    width: 1rem !important;
    height: 1rem !important;
    fill: currentColor !important;
}

/* ── Grid toolbar ─────────────────────────────────────────── */
.grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Stats cards ──────────────────────────────────────────── */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.stats-card .icon.primary { background: var(--primary-gradient); }
.stats-card .icon.success { background: var(--success-gradient); }
.stats-card .icon.info    { background: var(--info-gradient); }
.stats-card .icon.warning { background: var(--warning-gradient); }

.stats-card .stats-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #212529;
}

.stats-card .stats-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.875rem;
}

/* ── Modal overrides ──────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    border-bottom: none;
    padding: 1.25rem 1.5rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

/* ── Modern form controls ─────────────────────────────────── */
.form-control-modern {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control-modern:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label-modern {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ── Status badge ─────────────────────────────────────────── */
.badge-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* ── Animation ────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ── Sidebar: parent menu caret arrow ──────────────────────────────── */
.app-sidebar .menu .menu-item.has-sub > .menu-link .menu-caret {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.app-sidebar .menu .menu-item.has-sub > .menu-link .menu-caret::after {
    font-family: "bootstrap-icons";
    content: "\f282";
    font-size: 0.75rem;
    line-height: 1;
}

/* Rotate caret when submenu is expanded */
.app-sidebar .menu .menu-item.has-sub.expanded > .menu-link .menu-caret::after {
    transform: rotate(180deg);
}

/* Show submenu when expanded (client-side toggle) */
.app-sidebar .menu .menu-item.has-sub.expanded > .menu-submenu {
    display: block;
}

/* Highlight the parent menu link when its submenu is open */
.app-sidebar .menu .menu-item.has-sub.expanded > .menu-link {
    color: var(--app-sidebar-menu-link-active-color, #ffffff);
    font-weight: 600;
    background: var(--app-sidebar-menu-link-active-bg, rgba(255, 255, 255, 0.15));
    border-radius: 6px;
}

/* Active leaf menu item */
.app-sidebar .menu .menu-item.active:not(.has-sub) > .menu-link,
.app-sidebar .menu .menu-item .menu-link.active {
    font-weight: 600;
}
