/* Modern CSS Design System for Case Study Admin Panel - Inspired by DevsTree */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --font-primary: 'Calibri', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* DevsTree Light Theme (DEFAULT) */
    --bg-main: #f4f6f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;

    --border-color: #e2e8f0;
    --border-light: rgba(232, 3, 57, 0.25);

    --text-primary: #090b0e;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Primary Crimson Brand Colors */
    --accent-red: #e80339;
    --accent-red-hover: #c4022e;
    --accent-red-glow: rgba(232, 3, 57, 0.25);
    --accent-red-bg: rgba(232, 3, 57, 0.08);

    --accent-blue: #e80339;
    --accent-blue-hover: #c4022e;
    --accent-blue-glow: rgba(232, 3, 57, 0.25);

    --accent-emerald: #059669;
    --accent-emerald-bg: rgba(16, 185, 129, 0.12);
    --accent-rose: #e80339;
    --accent-rose-bg: rgba(232, 3, 57, 0.12);
    --accent-amber: #d97706;
    --accent-amber-bg: rgba(245, 158, 11, 0.12);
    --accent-purple: #e80339;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 25px -5px rgba(0, 0, 0, 0.08);

    --sidebar-width: 260px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* DevsTree Dark Theme Override */
[data-theme="dark"] {
    --bg-main: #090b0e;
    --bg-card: #0d0f12;
    --bg-card-hover: #161a22;
    --bg-sidebar: #060709;
    --bg-input: #060709;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(232, 3, 57, 0.25);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-muted: #6c727f;

    --accent-red-hover: #ff1a4f;
    --accent-red-glow: rgba(232, 3, 57, 0.35);
    --accent-red-bg: rgba(232, 3, 57, 0.12);

    --accent-blue-hover: #ff1a4f;
    --accent-blue-glow: rgba(232, 3, 57, 0.35);

    --accent-emerald: #10b981;
    --accent-emerald-bg: rgba(16, 185, 129, 0.15);
    --accent-amber: #f59e0b;
    --accent-amber-bg: rgba(245, 158, 11, 0.15);

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(232, 3, 57, 0.15);
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Authentication Page Styling */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(232, 3, 57, 0.15), transparent 45%),
        radial-gradient(circle at bottom left, rgba(232, 3, 57, 0.05), transparent 40%),
        var(--bg-main);
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s ease-out;
}

.auth-brand {
    text-align: center;
    margin-bottom: 30px;
}

.auth-brand .logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #e80339, #ff2a5b);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px var(--accent-red-glow);
}

.auth-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

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

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

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #e80339, #ff2a5b);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(232, 3, 57, 0.3);
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-menu {
    padding: 20px 12px;
    list-style: none;
    flex-grow: 1;
}

.menu-label {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 10px;
    transition: var(--transition);
}

.menu-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

.menu-link.active {
    color: white;
    background: linear-gradient(90deg, #e80339, #ff1a4f);
    box-shadow: 0 4px 14px var(--accent-red-glow);
}

.menu-link svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e80339, #ff2a5b);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info {
    flex-grow: 1;
    margin-left: 10px;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

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

.logout-btn {
    color: var(--text-muted);
    transition: var(--transition);
    padding: 6px;
    border-radius: 6px;
}

.logout-btn:hover {
    color: var(--accent-red);
    background-color: var(--accent-red-bg);
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.main-content {
    padding: 32px;
    flex-grow: 1;
}

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

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.stat-info .stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-info .stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 6px;
    line-height: 1;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.total {
    background: rgba(232, 3, 57, 0.12);
    color: var(--accent-red);
}

.stat-icon.active {
    background: var(--accent-emerald-bg);
    color: var(--accent-emerald);
}

.stat-icon.inactive {
    background: var(--accent-amber-bg);
    color: var(--accent-amber);
}

/* Component Cards & Panels */
.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

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

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Control Toolbar & Filters */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 260px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.form-control[readonly] {
    background-color: var(--bg-main);
    color: var(--text-muted);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.file-upload-box {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: var(--bg-main);
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-box:hover {
    border-color: var(--accent-red);
    background: rgba(232, 3, 57, 0.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #e80339, #ff2a5b);
    color: white;
    box-shadow: 0 4px 14px var(--accent-red-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff1a4f, #e80339);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--accent-red-glow);
}

.btn-secondary {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background-color: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid rgba(232, 3, 57, 0.3);
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: white;
}

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

/* Tables & AJAX Data Grid */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.data-table th {
    padding: 16px 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
    letter-spacing: 0.05em;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: var(--transition);
}

.data-table th.sortable:hover {
    color: var(--text-primary);
}

.data-table th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.5;
}

.data-table th.sorted .sort-icon {
    opacity: 1;
    color: var(--accent-red);
}

.data-table td {
    padding: 16px 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.data-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

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

.badge-active {
    background-color: var(--accent-emerald-bg);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-inactive {
    background-color: rgba(108, 114, 127, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(108, 114, 127, 0.25);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Pagination Control */
.pagination-container {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    gap: 6px;
    list-style: none;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.page-item .page-link:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #e80339, #ff2a5b);
    border-color: var(--accent-red);
    color: white;
    box-shadow: 0 2px 10px var(--accent-red-glow);
}

.page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Alert Messages */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger {
    background-color: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid rgba(232, 3, 57, 0.3);
}

.alert-success {
    background-color: var(--accent-emerald-bg);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ── Sticky WhatsApp Floating CTA ─────────────────────────────── */
.whatsapp-float {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background-color: #25d366;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  z-index: 9999;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background-color 0.3s ease;
}

.whatsapp-float:hover {
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.65);
  background-color: #20ba5a;
  color: #ffffff;
}

.whatsapp-float .whatsapp-icon {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.whatsapp-float::before {
  content: "Chat on WhatsApp";
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: rgba(37, 31, 42, 0.9);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.whatsapp-float:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.whatsapp-float::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #25d366;
  top: 0;
  left: 0;
  animation: wa-pulse 2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes wa-pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .whatsapp-float {
    right: 16px;
    width: 48px;
    height: 48px;
  }
  .whatsapp-float .whatsapp-icon {
    width: 26px;
    height: 26px;
  }
  .whatsapp-float::before {
    display: none;
  }
}

/* ── Scroll to Top Floating Button ─────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  background-color: var(--surface, #ffffff);
  color: var(--ink, #251f2a);
  border: 1px solid var(--line, rgba(37, 31, 42, 0.12));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 9998;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, visibility 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.scroll-top-btn:hover {
  transform: translateY(-4px) scale(1.08);
  background-color: var(--brand, #ff004c);
  color: #ffffff;
  border-color: var(--brand, #ff004c);
  box-shadow: 0 10px 25px rgba(255, 0, 76, 0.35);
}

.scroll-top-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 768px) {
  .scroll-top-btn {
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
  }
  .scroll-top-btn svg {
    width: 18px;
    height: 18px;
  }
}