/* CJRC Custom Styles */
:root {
    --primary: #af101a;
    --primary-dark: #8b0d15;
    --primary-light: #cc1a26;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
}

/* Pipeline arrow (horizontal) */
.pipeline-arrow {
    display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 16px 0;
}
.pipeline-step {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.pipeline-step .step-dot {
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 14px; font-weight: 600;
}
.pipeline-step.active .step-dot { background: #af101a; color: #fff; }
.pipeline-step.completed .step-dot { background: #16a34a; color: #fff; }
.pipeline-step.pending .step-dot { background: #e5e7eb; color: #6b7280; }
.pipeline-step .step-label { font-size: 11px; text-align: center; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipeline-connector { width: 40px; height: 2px; background: #e5e7eb; flex-shrink: 0; }
.pipeline-connector.completed { background: #16a34a; }

.profile-strength-gauge {
    width: 120px; height: 120px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 28px; font-weight: 700; margin: 0 auto;
    background: conic-gradient(#af101a var(--strength), #e5e7eb var(--strength));
}

/* Card styles */
.stats-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
}
.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.card-hover {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
}
.card-hover:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

/* Data table enhancements */
.data-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 12px 16px;
    border-bottom: 2px solid #e5e7eb;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.data-table tr:hover td {
    background-color: #fafafa;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Page transition */
.page-enter {
    animation: pageIn 0.3s ease-out;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease-out; }

/* Line clamp */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Container card for admin content pages */
.content-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e4beba;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

/* Timeline for activity/notes */
.timeline-item {
    position: relative;
    padding-left: 24px;
    padding-bottom: 16px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 20px;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}
.timeline-item:last-child::after { display: none; }

/* ── Sidebar overlay (mobile backdrop) ── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 45;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* ── Responsive sidebar ── */
.admin-sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 1023px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-sidebar.open ~ .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
    .main-content {
        margin-left: 0 !important;
    }
}
@media (min-width: 1024px) {
    .admin-sidebar {
        transform: translateX(0) !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
    .main-content {
        margin-left: 280px;
    }
}

/* ── Mobile-safe content tweaks ── */
@media (max-width: 767px) {
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    .content-card {
        padding: 16px;
    }
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Utility classes */
.text-primary { color: var(--primary); }
.text-primary-dark { color: var(--primary-dark); }
.bg-primary { background-color: var(--primary); }
.bg-primary\/80 { background-color: rgba(175, 16, 26, 0.8); }
.border-primary { border-color: var(--primary); }
.hover\:bg-primary\/90:hover { background-color: rgba(175, 16, 26, 0.9); }

/* Error handling */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.error-container { text-align: center; padding: 2rem; }
.error-code { font-size: 5rem; font-weight: 700; color: var(--primary); }
.error-message { font-size: 1.5rem; margin-top: 1rem; color: #374151; }

/* Input focus ring */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(175, 16, 26, 0.1) !important;
}

/* Button base */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
}
.btn-outline {
    background: transparent;
    border: 1px solid #e4beba;
    color: var(--primary);
}
.btn-outline:hover {
    background: rgba(175, 16, 26, 0.04);
    border-color: var(--primary);
}
.btn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Scrollbar styles */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Progress bar animation */
@keyframes progressGrow {
    from { width: 0; }
}
.progress-animate {
    animation: progressGrow 1s ease-out;
}

/* =============================================
   PROFILE HEADER — Facebook/LinkedIn-style
   ============================================= */

.profile-header-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

/* ----- COVER IMAGE ----- */
.cover-photo-wrapper {
    position: relative;
    height: 250px;
    overflow: hidden;
    z-index: 1;
    cursor: pointer;
}

.cover-photo-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.cover-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.cover-photo-wrapper:hover .cover-photo-img {
    transform: scale(1.02);
}

.cover-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.45));
    z-index: 2;
    pointer-events: none;
}

/* Change Cover button */
.change-cover-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.change-cover-btn:hover {
    background: rgba(0,0,0,0.7);
}

/* Cover loading overlay */
.cover-loader {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 6;
}
.cover-loader.active { display: flex; }

/* ----- AVATAR SECTION ----- */
.profile-info-area {
    position: relative;
    padding: 0 28px 24px;
    margin-top: -56px;
    z-index: 11;
}

.avatar-section {
    position: relative;
    margin-bottom: 0;
}

.avatar-wrapper {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    border: 5px solid #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    position: relative;
    z-index: 10;
    cursor: pointer;
    flex-shrink: 0;
    background: #f3f4f6;
    transition: box-shadow 0.2s;
}

.avatar-wrapper:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-size: 44px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    user-select: none;
}

/* Avatar hover overlay */
.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: 50%;
}

.avatar-wrapper:hover .avatar-overlay {
    opacity: 1;
}

.avatar-overlay-label {
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* Avatar loading spinner */
.avatar-loader {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 12;
}
.avatar-loader.active { display: flex; }

/* Spinner */
.profile-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: profileSpin 0.7s linear infinite;
}

@keyframes profileSpin {
    to { transform: rotate(360deg); }
}

/* ----- USER INFO ----- */
.profile-info-area .avatar-section {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.user-info-section {
    padding-bottom: 6px;
    min-width: 0;
}

.profile-user-name {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
}

.profile-user-role {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.role-pill {
    display: inline-flex;
    padding: 2px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(175,16,26,0.08);
    color: var(--primary);
    letter-spacing: 0.01em;
}

.role-dot {
    color: #d1d5db;
    font-size: 14px;
}

.role-slug {
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
    text-transform: capitalize;
}

.profile-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 12px;
}

.profile-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}

.profile-meta-icon {
    font-size: 16px !important;
    color: #9ca3af;
}

/* ----- FORM CARD ----- */
.profile-form-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.profile-form-header {
    margin-bottom: 24px;
}

.profile-form-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.profile-form-header p {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.profile-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.profile-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #111827;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: all 0.2s;
}

.profile-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(175,16,26,0.1);
    outline: none;
}

.profile-input::placeholder {
    color: #9ca3af;
}

/* ----- ACCOUNT INFO CARD ----- */
.profile-info-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 24px 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.profile-info-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.profile-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-info-label {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.profile-info-value {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

/* ----- TOAST NOTIFICATIONS ----- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    font-size: 14px;
    font-weight: 500;
    min-width: 300px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-success {
    background: #065f46;
    color: #fff;
}

.toast-error {
    background: #991b1b;
    color: #fff;
}

.toast .material-symbols-outlined {
    font-size: 22px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #fff;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ----- RESPONSIVE: TABLET ----- */
@media (max-width: 1023px) {
    .cover-photo-wrapper {
        height: 220px;
    }

    .avatar-wrapper {
        width: 120px;
        height: 120px;
    }

    .profile-info-area {
        margin-top: -50px;
    }

    .avatar-fallback {
        font-size: 38px;
    }

    .profile-user-name {
        font-size: 20px;
    }
}

/* ----- RESPONSIVE: MOBILE ----- */
@media (max-width: 767px) {
    .cover-photo-wrapper {
        height: 180px;
    }

    .change-cover-btn {
        top: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 12px;
    }
    .change-cover-btn .material-symbols-outlined {
        font-size: 16px !important;
    }

    .avatar-wrapper {
        width: 100px;
        height: 100px;
        border-width: 4px;
    }

    .profile-info-area {
        margin-top: -44px;
        padding: 0 20px 20px;
    }

    .profile-info-area .avatar-section {
        flex-direction: column;
        align-items: center;
    }

    .user-info-section {
        text-align: center;
    }

    .profile-user-name {
        font-size: 18px;
    }

    .profile-user-role {
        justify-content: center;
    }

    .profile-meta-grid {
        justify-content: center;
    }

    .profile-form-card {
        padding: 20px;
    }

    .profile-info-card {
        padding: 20px;
    }

    .profile-info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .avatar-fallback {
        font-size: 32px;
    }

    .toast {
        min-width: unset;
        max-width: calc(100vw - 40px);
        font-size: 13px;
        padding: 12px 16px;
    }
}

/* ----- RESPONSIVE: SMALL MOBILE ----- */
@media (max-width: 480px) {
    .cover-photo-wrapper {
        height: 140px;
    }

    .avatar-wrapper {
        width: 88px;
        height: 88px;
        border-width: 4px;
    }

    .profile-info-area {
        margin-top: -38px;
        padding: 0 16px 16px;
    }

    .profile-user-name {
        font-size: 16px;
    }

    .profile-info-grid {
        grid-template-columns: 1fr;
    }

    .profile-form-card,
    .profile-info-card {
        padding: 16px;
    }

    .avatar-fallback {
        font-size: 28px;
    }

    .profile-form-header h2 {
        font-size: 15px;
    }
}

/* =============================================
   TOPBAR NAVBAR USER PROFILE REDESIGN
   ============================================= */
.header-nav-avatar-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

/* Hover effect on avatar */
#user-menu:hover .header-nav-avatar-container {
    transform: scale(1.05);
}

/* Dropdown chevron rotate on active status */
#dropdown-arrow {
    transition: transform 0.25s ease;
}
#user-menu.active #dropdown-arrow {
    transform: rotate(180deg);
}

@media (min-width: 640px) {
    .header-nav-avatar-container {
        width: 44px;
        height: 44px;
    }
}

@media (min-width: 1024px) {
    .header-nav-avatar-container {
        width: 48px;
        height: 48px;
    }
}
