@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #475569;
    --primary-hover: #334155;
    --primary-light: #f1f5f9;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --text-on-primary: #ffffff;
    
    --border-color: #e2e8f0;
    --border-focus: #a5b4fc;
    
    /* Status Badge Colors */
    --status-pending-bg: #f1f5f9;
    --status-pending-text: #475569;
    --status-pending-border: #cbd5e1;
    
    --status-review-bg: #fef3c7;
    --status-review-text: #d97706;
    --status-review-border: #fcd34d;
    
    --status-approved-bg: #dbeafe;
    --status-approved-text: #2563eb;
    --status-approved-border: #93c5fd;
    
    --status-transferred-bg: #d1fae5;
    --status-transferred-text: #059669;
    --status-transferred-border: #6ee7b7;

    /* Theme Layout Variables */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --transition: all 0.2s ease-in-out;
}

* {
    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;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #0f172a;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Layout Framework */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.company-logo-img {
    max-height: 42px;
    max-width: 180px;
    object-fit: contain;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.925rem;
    transition: var(--transition);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-main);
    background-color: var(--bg-main);
}

.nav-link.active {
    background-color: var(--primary);
    color: #ffffff;
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--border-color);
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.profile-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.profile-details {
    overflow: hidden;
}

.profile-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-main);
}

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

/* Main Content Layout */
.app-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar Header */
.app-header {
    height: var(--header-height);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

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

.company-branding-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-branding-logo {
    max-height: 32px;
    max-width: 120px;
    object-fit: contain;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
}

.btn-logout:hover {
    color: #ef4444;
    background-color: #fef2f2;
    border-color: #fee2e2;
}

/* Inner Page Area */
.page-container {
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Grid & Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

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

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.stat-card-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.stat-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.stat-card-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.stat-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Sections & Panel Layouts */
.content-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 32px;
}

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

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.section-body {
    padding: 24px;
}

/* Forms CSS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.required-star {
    color: #ef4444;
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
    width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.input-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Professional Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

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

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: #475569;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Tables CSS */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.portal-table th {
    background-color: #f8fafc;
    padding: 16px 24px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.portal-table td {
    padding: 18px 24px;
    font-size: 0.875rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.portal-table tbody tr {
    transition: var(--transition);
}

.portal-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid transparent;
    text-transform: capitalize;
}

.badge-pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-text);
    border-color: var(--status-pending-border);
}

.badge-under_review_accounts {
    background-color: var(--status-review-bg);
    color: var(--status-review-text);
    border-color: var(--status-review-border);
}

.badge-approved_by_manager {
    background-color: var(--status-approved-bg);
    color: var(--status-approved-text);
    border-color: var(--status-approved-border);
}

.badge-transferred {
    background-color: var(--status-transferred-bg);
    color: var(--status-transferred-text);
    border-color: var(--status-transferred-border);
}

.badge-invited {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.badge-registered {
    background-color: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

/* Action Links inside Tables */
.table-action-btn {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.825rem;
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.table-action-btn:hover {
    background-color: var(--primary-light);
}

/* Login/Portal Access Page Designs */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f1f5f9;
    padding: 20px;
}

.auth-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-logo img {
    max-height: 60px;
    max-width: 240px;
    object-fit: contain;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-alert {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #ef4444;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.85rem;
    margin-bottom: 24px;
    font-weight: 500;
}

.auth-success {
    background-color: #ecfdf5;
    border: 1px solid #d1fae5;
    color: #059669;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.85rem;
    margin-bottom: 24px;
    font-weight: 500;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Link Copier Box */
.link-copy-box {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.link-input {
    background-color: #f1f5f9;
    font-family: monospace;
    font-size: 0.85rem;
}

/* Modal overlay styling (fallback custom or CSS-based alert) */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    margin-bottom: 16px;
    color: #94a3b8;
}

.empty-state-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.empty-state-subtitle {
    font-size: 0.875rem;
}

/* Modal and Detail Panels */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8fafc;
}

/* Utility classes */
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mr-2 { margin-right: 8px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.text-lg { font-size: 1.125rem; }

/* Grid columns for info lists */
.detail-list {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px 16px;
}

.detail-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-main);
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.active {
        transform: translateX(0);
    }
    .app-content {
        margin-left: 0;
    }
    .app-header {
        padding: 0 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .header-title {
        display: none;
    }
    .header-actions {
        order: 1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex: 1;
        gap: 12px;
    }
    .company-branding-header {
        margin-right: auto;
    }
    .sidebar-toggle {
        display: block !important;
        order: 2;
        margin-left: 12px;
    }
    .page-container {
        padding: 16px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .detail-list {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    /* Table Responsive Stack Layout */
    .portal-table, 
    .portal-table tbody, 
    .portal-table tr, 
    .portal-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    .portal-table thead {
        display: none !important;
    }
    .portal-table tr {
        margin-bottom: 16px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background-color: var(--bg-card);
        padding: 16px;
        box-shadow: var(--shadow-sm);
    }
    .portal-table td {
        border: none !important;
        border-bottom: 1px dashed #f1f5f9 !important;
        padding: 10px 0 !important;
        text-align: left !important;
        white-space: normal !important;
    }
    .portal-table td:last-child {
        border-bottom: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding-bottom: 0 !important;
        white-space: normal !important;
    }
    .portal-table td:last-child a,
    .portal-table td:last-child button {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        padding: 8px 12px !important;
        font-size: 0.825rem !important;
        text-align: center !important;
    }
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Info Alert boxes */
.info-alert {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    color: #1e3a8a;
    font-size: 0.875rem;
    margin-bottom: 24px;
}

.info-alert p {
    margin-top: 4px;
}
