/* ============================================
   TailAdmin - EXACT CSS Replication
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Modal - TailAdmin Style */
:root {
    /* Exact TailAdmin Colors */
    --primary: #465FFF;
    --primary-light: #6B7FFF;
    --primary-bg: #ECF3FF;

    --success: #039855;
    --success-bg: #ECFDF3;
    --warning: #DC6803;
    --warning-bg: #FFF4DE;
    --danger: #D92D20;
    --danger-bg: #FFE5E5;
    --info: #0369A1;
    --info-bg: #F0F9FF;

    /* Exact Backgrounds */
    --bg-body: #F9FAFB;
    --bg-card: #FFFFFF;
    --bg-gray: #F7F9FC;
    --bg-hover: #F9FAFB;

    /* Exact Text Colors */
    --text-primary: #1D2939;
    --text-body: #475569;
    --text-secondary: #667085;
    --text-muted: #98A2B3;

    /* Exact Border Colors */
    --border: #E4E7EC;
    --border-light: #EAECF0;

    /* Exact Shadows */
    --shadow-xs: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0px 1px 3px 0px rgba(16, 24, 40, 0.1);
    --shadow-md: 0px 4px 8px -2px rgba(16, 24, 40, 0.1);
    --shadow-lg: 0px 12px 16px -4px rgba(16, 24, 40, 0.08);

    /* Exact Measurements */
    --sidebar-width: 290px;
    --topbar-height: 80px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    color: var(--text-body);
    background: var(--bg-body);
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* Layout */
.admin-wrapper {
    display: flex;
}

/* Sidebar - Exact TailAdmin */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-card);
    border-right: 0.8px solid var(--border);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 30px 20px 20px;
    border-bottom: 0.8px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-img {
    height: 36px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
}

.sidebar-nav {
    padding: 30px 0;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section-title {
    padding: 0 20px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 0 12px 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.15s;
}

.nav-link i {
    font-size: 20px;
    width: 20px;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-body);
}

/* Topbar - Exact TailAdmin */
.topbar {
    height: var(--topbar-height);
    padding: 0 32px 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-bottom: 0.8px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left .action-btn {
    background: var(--bg-gray);
}

.topbar-left .action-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gray);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    transition: all 0.15s;
    position: relative;
}

.action-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.action-btn .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 6px 12px;
    background: var(--bg-gray);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.15s;
}

.user-menu:hover {
    background: var(--primary-bg);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.user-name {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-primary);
}

/* User Menu Dropdown */
.user-menu-wrapper {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 0.8px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.dropdown-item i {
    font-size: 18px;
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-item-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
}

/* Content Wrapper */
.content-wrapper {
    padding: 32px 40px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color 0.15s;
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 0.8px solid;
    font-weight: 500;
    font-size: 15px;
}

.alert-success {
    background: var(--success-bg);
    border-color: #86EFAC;
    color: var(--success);
}

.alert-danger {
    background: var(--danger-bg);
    border-color: #FECACA;
    color: var(--danger);
}

/* Cards - Exact TailAdmin */
.card {
    background: var(--bg-card);
    border: 0.8px solid var(--border-light);
    border-radius: 16px;
    box-shadow: var(--shadow-xs);
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 0.8px solid var(--border-light);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 28px;
}

.card-body {
    padding: 20px 16px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 0.8px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-xs);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-icon.primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 40px;
    margin-bottom: 8px;
}

.stat-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 20px;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

/* Tables - Exact TailAdmin */
.table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 12px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-gray);
    border-bottom: 0.8px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 16px;
}

.table td {
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-body);
    border-bottom: 0.8px solid var(--border-light);
    line-height: 24px;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges - Exact TailAdmin */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-secondary {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

/* Buttons - Exact TailAdmin */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    line-height: 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 0.8px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-gray);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 14px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

/* Forms - Exact TailAdmin */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 20px;
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 24px;
    color: var(--text-body);
    background: var(--bg-card);
    border: 0.8px solid var(--border);
    border-radius: 8px;
    transition: all 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(70, 95, 255, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select,
select.form-control {
    width: 100%;
    height: 44px;
    padding: 10px 40px 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 24px;
    color: var(--text-body);
    background-color: var(--bg-card);
    border: 0.8px solid var(--border);
    border-radius: 8px;
    transition: all 0.15s;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(70, 95, 255, 0.1);
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 12px;
}

textarea.form-control {
    min-height: 120px;
    height: auto;
    resize: vertical;
    padding: 12px 16px;
}

/* Checkboxes & Radio */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #6B7280;
    border: 1px solid #4B5563;
    border-radius: 26px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background: #10B981;
    border-color: #059669;
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.15s;
}

.pagination a {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 0.8px solid var(--border);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .active span {
    background: var(--primary);
    color: white;
    border: 0.8px solid var(--primary);
}

/* Laravel Pagination Specific Styles */
.pagination nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.pagination nav>div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination nav>div:first-child {
    display: none;
}

.pagination nav>div:last-child {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination nav span[aria-current="page"] span {
    background: var(--primary);
    color: white;
    border: 0.8px solid var(--primary);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 500;
}

.pagination nav a {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 0.8px solid var(--border);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 500;
    padding: 0 12px;
    text-decoration: none;
    transition: all 0.15s;
}

.pagination nav a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination nav span.cursor-default {
    background: var(--bg-gray);
    color: var(--text-muted);
    border: 0.8px solid var(--border);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0 12px;
}

.pagination nav p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination nav p span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 24px;
    margin-bottom: 24px;
}

/* Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.text-danger {
    color: var(--danger);
    font-size: 14px;
    font-weight: 400;
    margin-top: 6px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 14px;
}

.text-break {
    word-break: break-word;
}

.small {
    font-size: 14px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
}

/* File Input - Custom Style */
input[type="file"] {
    padding: 6px;
    height: auto;
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--text-primary);
    background: var(--bg-gray);
    border: 0.8px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

input[type="file"]::file-selector-button:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.mobile-active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .content-wrapper {
        padding: 20px;
    }
}