@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #64748b;
    --success: #4f46e5;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 260px;
    --header-height: 70px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* Legacy AdminLTE Overrides */
.main-wrapper .right-side,
.main-wrapper .left-side {
    margin-left: 0 !important;
    position: relative !important;
    top: 0 !important;
}

.main-wrapper .wrapper {
    background: transparent !important;
    min-height: auto !important;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    /* Override Bootstrap body padding */
    padding-top: 0 !important;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

/* Layout - override Bootstrap container */
.app-container {
    display: block !important;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    z-index: 1000; /* Higher z-index */
    transition: transform 0.3s ease, visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.sidebar:not(.open) {
    /* Ensure it doesn't block clicks on mobile when closed */
    @media (max-width: 1024px) {
        visibility: hidden;
    }
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Custom Scrollbar for Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
}

.menu-group {
    margin-bottom: 5px;
}

.has-submenu {
    position: relative;
    cursor: pointer;
    justify-content: space-between !important;
}

.has-submenu::after {
    content: '\f105';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.has-submenu.open::after {
    transform: rotate(90deg);
}

.submenu {
    background: #f8fafc;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.has-submenu.open+.submenu {
    max-height: 1000px;
}

.submenu .menu-item {
    padding-left: 3rem;
    font-size: 0.9rem;
    border-left: none;
}

.menu-item {
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #475569;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.menu-item:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.menu-item.active {
    background-color: #eef2ff;
    color: var(--primary);
    border-left-color: var(--primary);
}

.menu-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-wrapper {
    width: calc(100% - var(--sidebar-width)) !important;
    margin-left: var(--sidebar-width) !important;
    transition: all 0.3s ease;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10; /* Above legacy content */
}

@media (max-width: 1024px) {
    .main-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
    }
}

.top-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Breadcrumbs & Page Headers */
.content-header {
    background: transparent;
    padding: 1rem 0 2rem 0;
    margin-bottom: 0px;
}

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-header h1 small {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 1rem;
}

.breadcrumb {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.825rem;
    display: flex;
}

.breadcrumb > li {
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.breadcrumb > li + li::before {
    content: "/";
    padding: 0 10px;
    color: var(--border);
    font-weight: 400;
}

.breadcrumb > li a {
    color: var(--primary);
    font-weight: 500;
}

/* Icons & Actions */
.edit-icon {
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.edit-icon:hover {
    color: var(--primary-dark);
    background-color: #eef2ff;
    transform: scale(1.15);
}

.delete-icon {
    color: var(--danger);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.delete-icon:hover {
    color: #b91c1c;
    background-color: #fef2f2;
    transform: scale(1.15);
}

.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.content-body {
    padding: 1.5rem 2rem;
    overflow-x: auto;
    flex: 1;
    position: relative;
    z-index: 1;
}

/* UI Elements */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 0px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background-color: var(--primary-dark);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background-color: #dc2626;
}


/* Table */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th {
    background: #f8fafc;
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

td {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Bootstrap-compatible table modifiers */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 1rem;
}

.table th,
.table td {
    padding: 0.6rem 0.9rem;
    vertical-align: middle;
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, .03);
}

.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, .05);
}

/* Box container (AdminLTE style) */
.box {
    position: relative;
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.box-success {
    border-top: 3px solid var(--success);
}

.box-primary {
    border-top: 3px solid var(--primary);
}

.box-myclass {
    border-top: 3px solid var(--primary);
}

.box-body {
    padding: 1rem;
    border-radius: 0 0 8px 8px;
}

.box-solid {
    border: 1px solid var(--border);
}

/* Content section */
.content {
    padding: 10px 15px;
}

/* Text utility */
.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Row */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}


/* Badges/Status */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }
}

@media (max-width: 640px) {
    .content-body {
        padding: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Pagination Styles */
.pagination {
    display: inline-flex;
    padding-left: 0;
    list-style: none;
    border-radius: 0.25rem;
    margin: 20px 0;
}

.pagination>li>a,
.pagination>li>span {
    position: relative;
    float: left;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #4f46e5;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
    cursor: pointer;
}

.pagination>li:first-child>a {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.pagination>li:last-child>a {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.pagination>li.active>a {
    z-index: 3;
    color: #fff;
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.pagination>li.disabled>a {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
}

.pagination>li>a:hover {
    color: #4338ca;
    background-color: #e9ecef;
    border-color: #dee2e6;
}