/* ============================================
   HRPro - TailAdmin Inspired Theme
   ============================================ */

:root {
    --sidebar-width: 290px;
    --sidebar-collapsed-width: 90px;
    --header-height: 70px;
    --brand-primary: #465fff;
    --brand-primary-hover: #3a4fdb;
    --brand-primary-light: rgba(70, 95, 255, 0.08);
    --brand-primary-bg: rgba(70, 95, 255, 0.12);
    --bg-body: #f5f7fa;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Base
   ============================================ */
* { box-sizing: border-box; }

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html { font-size: 15px; }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }

/* ============================================
   Layout Wrapper
   ============================================ */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--brand-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--brand-primary-light);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.sidebar-nav-section {
    padding: 8px 24px 6px;
}

.sidebar-nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    padding: 0 12px;
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.sidebar-nav-link:hover {
    color: var(--brand-primary);
    background: var(--brand-primary-light);
}

.sidebar-nav-link.active {
    color: var(--brand-primary);
    background: var(--brand-primary-bg);
    font-weight: 600;
}

.sidebar-nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav-link.active .sidebar-nav-icon {
    color: var(--brand-primary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================
   Header
   ============================================ */
.main-header {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
    align-items: center;
}

.header-search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.header-search-input {
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.87rem;
    background: var(--bg-body);
    color: var(--text-primary);
    width: 240px;
    transition: var(--transition);
    outline: none;
}

.header-search-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
    width: 300px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-action-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.header-action-btn:hover {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

.header-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.header-user-btn:hover {
    background: var(--bg-body);
}

.header-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.header-user-name {
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--text-primary);
}

.header-dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 200px;
}

.header-dropdown-menu .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.87rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.header-dropdown-menu .dropdown-item:hover {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

/* ============================================
   Page Content
   ============================================ */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-header h6,
.card-header h5 {
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* ============================================
   Stat Cards
   ============================================ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.stat-card-icon.primary {
    background: rgba(70, 95, 255, 0.1);
    color: var(--brand-primary);
}

.stat-card-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-card-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-card-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-card-icon.info {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.stat-card-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-card-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.stat-card-change {
    font-size: 0.78rem;
    font-weight: 500;
}

.stat-card-change.positive { color: #10b981; }
.stat-card-change.negative { color: #ef4444; }
.stat-card-change.neutral { color: var(--text-muted); }

/* ============================================
   Tables
   ============================================ */
.table {
    margin-bottom: 0;
    font-size: 0.88rem;
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(70, 95, 255, 0.03);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.87rem;
    padding: 8px 18px;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(70, 95, 255, 0.3);
}

.btn-outline-primary {
    border: 1px solid var(--brand-primary);
    color: var(--brand-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-body);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline-success { border-color: #10b981; color: #10b981; }
.btn-outline-success:hover { background: #10b981; color: #fff; }
.btn-outline-danger { border-color: #ef4444; color: #ef4444; }
.btn-outline-danger:hover { background: #ef4444; color: #fff; }
.btn-outline-warning { border-color: #f59e0b; color: #f59e0b; }
.btn-outline-warning:hover { background: #f59e0b; color: #fff; }
.btn-outline-info { border-color: #06b6d4; color: #06b6d4; }
.btn-outline-info:hover { background: #06b6d4; color: #fff; }

/* ============================================
   Badges
   ============================================ */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
}

.badge.bg-primary { background: var(--brand-primary) !important; }
.badge.bg-success { background: #10b981 !important; }
.badge.bg-warning { background: #f59e0b !important; color: #000; }
.badge.bg-danger { background: #ef4444 !important; }
.badge.bg-info { background: #06b6d4 !important; }
.badge.bg-secondary { background: var(--text-muted) !important; }

/* ============================================
   Forms
   ============================================ */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: var(--transition);
    background-color: var(--bg-card);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 20px;
}

/* ============================================
   Alerts
   ============================================ */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #065f46;
    border-radius: var(--radius-md);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #991b1b;
    border-radius: var(--radius-md);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
    border-radius: var(--radius-md);
}

/* ============================================
   Pagination
   ============================================ */
.page-item .page-link {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 8px 14px;
    margin: 0 2px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.page-item.active .page-link {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.page-item .page-link:hover {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* ============================================
   Progress
   ============================================ */
.progress {
    background: var(--bg-body);
    border-radius: 20px;
    height: 8px;
    border: none;
}

.progress-bar {
    border-radius: 20px;
    background: var(--brand-primary);
}

/* ============================================
   Modal
   ============================================ */
.modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1199.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 16px;
    }

    .main-header {
        padding: 0 16px;
    }

    .header-search {
        display: none !important;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card-value {
        font-size: 1.35rem;
    }
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-brand { color: var(--brand-primary) !important; }
.bg-brand-light { background: var(--brand-primary-light) !important; }
.border-brand { border-color: var(--brand-primary) !important; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .stat-card {
    animation: fadeIn 0.4s ease-out;
}

/* ============================================
   Dropdown in tables
   ============================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}
