/* CSS Variables / Theme Tokens for Jobready */
:root {
    --primary-color: #4361ee;
    --primary-hover: #3a0ca3;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover-bg: #1e293b;
    --sidebar-active-text: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

/* App Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-header h2 span,
.sidebar.collapsed .sidebar-nav li span {
    display: none !important;
    /* fallback if JS needed, but CSS popout below is better */
}

/* Base styles for labels in compact mode to allow popout */
.sidebar.collapsed .sidebar-nav li {
    position: relative;
    overflow: visible;
    /* ensure popout is visible */
}

.sidebar.collapsed .sidebar-nav li span {
    display: none !important;
    position: absolute;
    left: 70px;
    background: var(--sidebar-bg);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-nav li:hover span {
    display: block !important;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar.collapsed .full-logo {
    display: none !important;
}

.sidebar .compact-logo {
    display: none;
}

.sidebar.collapsed .compact-logo {
    display: block;
    height: 42px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(67, 97, 238, 0.3));
}

.sidebar-header {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.sidebar-header .logo-container {
    display: flex;
    align-items: center;
    transition: all 0.3s;
}

.sidebar-header .logo-container img {
    height: 48px;
    width: auto;
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    padding: 12px 24px;
    margin: 4px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-nav li:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-active-text);
}

.sidebar-nav li.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border-left: 5px solid var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(67, 97, 238, 0.05);
}

.sidebar.collapsed .sidebar-nav li.active {
    background-color: var(--primary-color);
    color: white;
    border-left: none;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.sidebar-nav li .menu-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-nav li {
    padding: 12px 0;
    justify-content: center;
    margin: 4px 12px;
    width: auto;
    border-radius: 10px;
}

.sidebar.collapsed .sidebar-nav li .menu-icon {
    width: auto;
    margin: 0;
}

.sidebar.collapsed .sidebar-nav li.active .menu-icon {
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevents flex flex-grow overflow */
}

/* Header */
.top-header {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px;
}

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

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    padding: 8px 16px;
    border-radius: 20px;
    width: 320px;
    transition: width 0.3s;
}

.header-search:focus-within {
    width: 400px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.1);
}

.header-search i {
    color: var(--text-muted);
}

.header-search input {
    border: none;
    background: transparent;
    margin-left: 10px;
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Profile Section Enhancements */
.profile-wrapper {
    position: relative;
    user-select: none;
}

.user-profile {
    position: relative;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    transition: background 0.2s;
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-profile .avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.user-profile:hover .avatar {
    border-color: rgba(67, 97, 238, 0.2);
}

.user-profile .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hover Tooltip */
.profile-tooltip {
    position: absolute;
    top: 50px;
    right: 0;
    background: #444746;
    color: #e3e3e3;
    padding: 12px 16px;
    border-radius: 8px;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    z-index: 1001;
    text-align: left;
}

.user-profile:hover .profile-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-title {
    font-size: 0.75rem;
    color: #c4c7c5;
    margin-bottom: 4px;
}

.tooltip-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.tooltip-email {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Profile Popup */
.profile-popup {
    position: absolute;
    top: 50px;
    right: 0;
    width: 380px;
    background: #2d2f31;
    color: #e3e3e3;
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
}

.profile-popup.active {
    display: flex;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.popup-email {
    font-size: 0.85rem;
    color: #c4c7c5;
}

.btn-close-popup {
    background: transparent;
    border: none;
    color: #c4c7c5;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

.btn-close-popup:hover {
    background: rgba(255, 255, 255, 0.05);
}

.popup-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    text-align: center;
}

.popup-avatar-container {
    position: relative;
    margin-bottom: 16px;
}

.large-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-color);
}

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

.edit-avatar-btn {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #3c4043;
    border: 1px solid #5f6368;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-greeting {
    font-size: 1.4rem;
    margin-bottom: 24px;
    font-weight: 400;
}

.btn-manage-account {
    background: transparent;
    border: 1px solid #8e918f;
    color: #c2e7ff;
    padding: 10px 24px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
}

.btn-manage-account:hover {
    background: rgba(194, 231, 255, 0.05);
}

.popup-roles-section {
    background: #1e1f20;
    margin: 8px;
    border-radius: 20px;
    padding: 16px;
}

.section-title {
    font-size: 0.75rem;
    color: #c4c7c5;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.role-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.role-item.active {
    background: rgba(67, 97, 238, 0.15);
    border: 1px solid rgba(67, 97, 238, 0.3);
}

.role-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3c4043;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.role-info {
    text-align: left;
}

.role-name {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
}

.role-org {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

.popup-footer {
    display: flex;
    justify-content: center;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout {
    background: #3c4043;
    color: #f2f2f2;
    border: none;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.btn-logout:hover {
    background: #4a4e52;
}

/* Launcher Wrapper & Trigger */
.launcher-wrapper {
    position: relative;
}

.launcher-trigger {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.launcher-trigger:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Launcher Popup */
.launcher-popup {
    position: absolute;
    top: 50px;
    right: -10px;
    width: 380px;
    background: #f8fafc;
    /* Match bg-main */
    color: var(--text-main);
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: none;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.launcher-popup.active {
    display: flex;
}

.launcher-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.launcher-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.launcher-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
}

.launcher-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.launcher-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.launcher-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.launcher-item:hover .launcher-item-icon {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.launcher-item span {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

/* Content Body */
.content-body {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

/* Reusable Components */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Dashboard Specifics */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

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

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}
/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 500px;
    max-width: 95%;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sidebar-bg);
}

.modal-body {
    padding: 32px;
}

.modal-footer {
    padding: 20px 32px;
    background: var(--bg-main);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    color: var(--text-main);
    background: white;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.form-control::placeholder {
    color: #cbd5e1;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
}

/* Select2 Premium Customization */
.select2-container--default .select2-selection--single {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    height: 48px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main);
    padding-left: 16px;
    font-size: 1rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px;
    right: 12px;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.select2-dropdown {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    z-index: 10001;
    margin-top: 5px;
}

.select2-results__option {
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
}

/* Template Designer Styles */
.sortable-list {
    min-height: 50px;
}

.designer-item {
    background: white;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.designer-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.designer-item .handle {
    color: #cbd5e1;
    cursor: grab;
}

.designer-item .item-type {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: #f1f5f9;
    border-radius: 4px;
    color: #64748b;
    text-transform: uppercase;
}

.canvas-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 15px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.canvas-item .item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #f1f5f9;
}

.canvas-item .remove-item {
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.canvas-item .remove-item:hover {
    color: var(--danger);
}

.ghost-item {
    opacity: 0.4;
    background: var(--primary-color) !important;
}

.chosen-item {
    border: 2px solid var(--primary-color);
}

/* Tab Designer Specifics */
.designer-tab-item {
    background: #4f46e5;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
    border: 1px solid #4338ca;
    animation: slideIn 0.3s ease;
}

.designer-tab-item input {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    width: 100px;
    outline: none;
    transition: all 0.2s;
}

.designer-tab-item input:focus {
    background: white;
    color: var(--sidebar-bg);
    width: 140px;
}

.designer-tab-item .remove-tab {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.designer-tab-item .remove-tab:hover {
    opacity: 1;
}

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

/* Nested Designer Layout */
.canvas-item.active-tab-context {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color)20;
}

.designer-tab-item.active {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.designer-tab-item.active input {
    background: #f1f5f9;
    color: var(--sidebar-bg);
}

.column-container {
    min-height: 80px;
    background: rgba(255,255,255,0.5);
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.canvas-item[data-type-id="12"] { /* Column */
    border-style: solid;
    background: #f0fdf4;
}

.canvas-item[data-type-id="12"] .column-dropzone {
    min-height: 60px;
    border: 1px dashed #10b981;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.05);
    padding: 10px;
}
