/* Layout Grid: Header + (Sidebar + Main) */
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll, handle in main */
}

/* --- HEADER --- */
.app-header {
    height: 70px;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--navy-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-btn {
    background: var(--bg-main);
    border: 1px solid var(--navy);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: var(--bg-card);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.02em;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-role {
    padding: 6px 14px;
    background: var(--navy);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    border: 1px solid var(--navy-dark);
}

.logout-link {
    color: #ef4444; /* Keep red for danger, but could use a palette variant if available */
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.logout-link:hover {
    background: #fef2f2;
}



/* --- CONTAINER (Sidebar + Main) --- */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden; /* Contain scrollbars */
    position: relative;
    transition: all 0.3s ease;
}

/* --- SIDEBAR --- */
.app-sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--navy-dark);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    z-index: 90;
}

.app-sidebar.collapsed {
    width: 80px;
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.sidebar-content::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.sidebar-content {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.sidebar-label {
    padding: 0 25px;
    margin-bottom: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--navy);
    letter-spacing: 0.05rem;
    opacity: 0.7;
}

.app-sidebar.collapsed .sidebar-label {
    opacity: 0;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-section {
    margin-bottom: 1rem;
}

.sidebar-label {
    padding: 0 25px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--navy);
    letter-spacing: 0.1rem;
    opacity: 0.8;
}

.nav-links li {
    padding: 4px 15px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 5px 14px;
    color: var(--navy);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    gap: 12px;
}

.nav-links a:hover {
    background-color: rgba(12, 73, 131, 0.1);
    color: var(--navy-light);
}

/* Icons */
.nav-links a i {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    color: var(--navy);
}

.nav-links li.active a i{
    color: #fff;
}

/* Link Text */
.link-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.app-sidebar.collapsed .link-text {
    opacity: 0;
    pointer-events: none;
}

/* Sidebar Active State */
.nav-links li.active a {
    background: var(--navy);
    color: #fff;
}

/* Sidebar Footer Profile Area */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--navy-dark);
    background: var(--ghostwhite);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-info {
    transition: opacity 0.3s ease;
}

.app-sidebar.collapsed .profile-info {
    opacity: 0;
}

.profile-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy);
}

.profile-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}




/* --- MAIN AREA --- */
/* Hero Continue Button */
.btn-continue {
    background: var(--navy);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(12, 73, 131, 0.2);
}

.btn-continue:hover {
    transform: translateX(5px);
    background: var(--navy-light);
    box-shadow: 0 6px 16px rgba(12, 73, 131, 0.3);
}

/* Activity Placeholder */
.activity-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    color: #64748b;
}

.placeholder-icon {
    font-size: 3.5rem;
    color: #e2e8f0;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.placeholder-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.placeholder-text {
    font-size: 0.95rem;
    max-width: 280px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.app-main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto; /* Scrollable main area */
    background-color: var(--bg-primary);
}

/* --- SPA ANIMATIONS & ACTIVE STATE --- */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spa-section {
    animation: fadeInSlide 0.4s ease-out forwards;
}

/* --- TOOL MODAL --- */
.tool-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.6); /* deep slate transparent */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-modal-content {
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: fadeInSlide 0.3s ease-out;
}

.tool-modal-header {
    height: 60px;
    padding: 0 20px;
    background: var(--ghostwhite);
    border-bottom: 1px solid var(--navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.tool-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--navy);
    font-weight: 600;
}

.tool-modal-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    width: 36px; height: 36px;
    border-radius: 8px;
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--navy);
    color: white;
}

.tool-modal-body {
    flex: 1;
    position: relative;
    background: var(--ghostwhite); /* fallback behind iframe */
}

.tool-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: relative;
    z-index: 10;
}

.tool-modal-loading {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--navy);
    font-weight: 500;
}

/* --- MOBILE RESPONSIVENESS (LAYOUT) --- */

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 85;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    /* Header Adjustments */
    .app-header {
        padding: 0 15px;
    }

    .brand {
        gap: 10px;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .user-profile {
        gap: 10px;
    }

    /* Hide role text to save space, keeping just Logout on mobile */
    .user-role {
        display: none;
    }

    /* Sidebar becomes absolute drawer */
    .app-sidebar {
        position: fixed;
        top: 70px; /* Below header */
        left: 0;
        height: calc(100vh - 70px);
        transform: translateX(-100%);
        z-index: 90;
        box-shadow: 5px 0 25px rgba(0,0,0,0.1);
    }

    .app-sidebar.show-mobile {
        transform: translateX(0);
    }

    /* Override collapsed behavior on mobile */
    .app-sidebar.collapsed {
        width: 260px; /* Don't collapse to icon view on mobile */
    }

    .app-sidebar.collapsed .link-text,
    .app-sidebar.collapsed .sidebar-label,
    .app-sidebar.collapsed .profile-info {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main Area */
    .app-main {
        padding: 15px;
    }

    /* Adjust Modals */
    .tool-modal-content {
        width: 95%;
        height: 90vh;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0 10px;
    }

    .nav-links li {
        padding: 4px 10px;
    }
}

