/**
 * Admin Unified Styles
 * Shared CSS for all admin pages - extracted from duplicated inline styles
 * @version 1.0.0
 */

/* ============================================
   LAYOUT
   ============================================ */

.admin-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: 100vh;
}

@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

/* ============================================
   SIDEBAR (Legacy - fallback for non-web-component)
   ============================================ */

.sidebar {
    background: var(--md-sys-color-surface-container-highest);
    color: rgba(255, 255, 255, 0.9);
    padding: 24px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font: var(--md-sys-typescale-title-large);
    color: var(--md-sys-color-primary);
    text-decoration: none;
    margin-bottom: 8px;
}

.sidebar-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 4px;
    font: var(--md-sys-typescale-label-small);
    margin-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--md-sys-shape-corner-medium);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font: var(--md-sys-typescale-label-large);
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--md-sys-color-on-primary);
}

.nav-item.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    background: var(--md-sys-color-surface, #FAFAFA);
    padding: 32px;
    overflow-y: auto;
}

.main-content.dark {
    background: var(--md-sys-color-inverse-surface);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font: var(--md-sys-typescale-headline-medium);
    color: var(--md-sys-color-on-surface);
}

.page-subtitle,
.page-title+.body-medium {
    font: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-on-surface-variant);
}

/* Dark mode variants */
.main-content.dark .page-title {
    color: var(--md-sys-color-on-primary);
}

.main-content.dark .page-subtitle {
    color: var(--md-sys-color-on-surface-variant);
}

/* ============================================
   SECTION CONTAINERS
   ============================================ */

.section-container {
    background: var(--md-sys-color-surface);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--md-sys-elevation-1);
}

.section-container.dark {
    background: var(--md-sys-color-inverse-surface);
    border: 1px solid #30363D;
}

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

.section-title {
    font: var(--md-sys-typescale-title-medium);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-container.dark .section-title {
    color: var(--md-sys-color-on-primary);
}

.section-body {
    padding: 24px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font: var(--md-sys-typescale-label-large);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0, 106, 96, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

.btn-secondary:hover {
    background: var(--md-sys-color-surface-container);
}

.btn-success {
    background: #4CAF50;
    color: var(--md-sys-color-on-primary);
}

.btn-success:hover {
    background: #43A047;
}

.btn-danger {
    background: var(--md-sys-color-error, #DC3545);
    color: var(--md-sys-color-on-primary);
}

/* Dark theme buttons */
.btn-primary.dark {
    background: var(--md-sys-color-primary);
}

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

.btn-secondary.dark {
    background: var(--md-sys-color-inverse-surface);
    color: #C9D1D9;
    border: 1px solid #30363D;
}

.btn-secondary.dark:hover {
    background: #30363D;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stats-row,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--md-sys-color-surface);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--md-sys-elevation-1);
    text-align: center;
}

.stat-card.dark {
    background: var(--md-sys-color-inverse-surface);
    border: 1px solid #30363D;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

/* Stat icon color variants */
.stat-icon.primary {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-tertiary);
}

.stat-icon.success {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-success-container, var(--md-sys-color-primary));
}

.stat-icon.warning {
    background: var(--md-sys-color-surface)3E0;
    color: var(--md-sys-color-secondary);
}

.stat-icon.purple {
    background: #F3E5F5;
    color: #7B1FA2;
}

.stat-icon.sent {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-tertiary);
}

.stat-icon.opened {
    background: var(--md-sys-color-surface)3E0;
    color: var(--md-sys-color-secondary);
}

.stat-icon.signed {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-success-container, var(--md-sys-color-primary));
}

.stat-icon.rate {
    background: #F3E5F5;
    color: #7B1FA2;
}

.stat-value {
    font: var(--md-sys-typescale-headline-medium);
    color: var(--md-sys-color-on-surface);
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-value.green {
    color: var(--md-sys-color-primary);
}

.stat-value.blue {
    color: var(--md-sys-color-tertiary);
}

.stat-value.purple {
    color: var(--md-sys-color-tertiary);
}

.stat-value.orange {
    color: var(--md-sys-color-secondary);
}

.stat-label {
    font: var(--md-sys-typescale-label-medium);
    color: var(--md-sys-color-on-surface-variant);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font: var(--md-sys-typescale-label-medium);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    font: var(--md-sys-typescale-body-medium);
    transition: border-color 0.2s ease;
    background: var(--md-sys-color-surface);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

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

/* Search box */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--md-sys-color-surface-container, var(--md-sys-color-surface-container));
    border-radius: var(--md-sys-shape-corner-full, 999px);
    flex: 1;
    max-width: 400px;
}

.search-box input {
    border: none;
    background: none;
    font: var(--md-sys-typescale-body-medium);
    width: 100%;
    outline: none;
}

.filter-dropdown {
    padding: 10px 16px;
    border: 1px solid var(--md-sys-color-outline, var(--md-sys-color-outline-variant));
    border-radius: var(--md-sys-shape-corner-medium, 8px);
    background: white;
    font: var(--md-sys-typescale-label-large);
    cursor: pointer;
}

/* ============================================
   CARDS & GRIDS
   ============================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: var(--md-sys-color-surface, #fff);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--md-sys-elevation-1);
    transition: all 0.3s ease;
}

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

.card-elevated {
    box-shadow: var(--md-sys-elevation-2);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font: var(--md-sys-typescale-label-small);
    font-weight: 500;
}

.status-badge.active,
.status-badge.success,
.status-badge.signed {
    background: var(--md-sys-color-success-container, rgba(63, 185, 80, 0.2));
    color: var(--md-sys-color-on-success-container, var(--md-sys-color-primary));
}

.status-badge.pending,
.status-badge.warning,
.status-badge.opened {
    background: var(--md-sys-color-warning-container, rgba(210, 153, 34, 0.2));
    color: var(--md-sys-color-on-warning-container, #E65100);
}

.status-badge.error,
.status-badge.danger {
    background: var(--md-sys-color-error-container, rgba(248, 81, 73, 0.2));
    color: var(--md-sys-color-on-error-container, var(--md-sys-color-error));
}

.status-badge.info,
.status-badge.sent {
    background: rgba(88, 166, 255, 0.2);
    color: var(--md-sys-color-tertiary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-24 {
    gap: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.mb-32 {
    margin-bottom: 32px;
}

.text-muted {
    color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface-variant));
}

.text-center {
    text-align: center;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* Animation utility classes */
.animate-fade-in {
    animation: fadeInUp 0.4s ease-out backwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease backwards;
}

/* Staggered animations */
.animate-fade-in:nth-child(1) {
    animation-delay: 0.1s;
}

.animate-fade-in:nth-child(2) {
    animation-delay: 0.15s;
}

.animate-fade-in:nth-child(3) {
    animation-delay: 0.2s;
}

.animate-fade-in:nth-child(4) {
    animation-delay: 0.25s;
}

.animate-fade-in:nth-child(5) {
    animation-delay: 0.3s;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: 12px;
    font: var(--md-sys-typescale-body-medium);
    font-size: 14px;
    box-shadow: var(--md-sys-elevation-2);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

.toast.success {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-success-container, var(--md-sys-color-primary));
}

.toast.error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container, var(--md-sys-color-error));
}

.toast.warning {
    background: var(--md-sys-color-surface)3E0;
    color: var(--md-sys-color-on-warning-container, #E65100);
}

.toast.info {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-tertiary);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .section-container {
        padding: 20px;
        border-radius: 16px;
    }

    .btn {
        padding: 12px 20px;
    }
}
/* ================================================
   PREMIUM ADDITIONS (Merged from admin-premium.css)
   ================================================ */

/* GLASSMORPHISM MODAL */
#modal-overlay {
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    background: rgba(0, 0, 0, 0.4) !important;
}

#modal-overlay .modal-content {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* MICRO-ANIMATIONS & HOVER EFFECTS */
.card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 106, 96, 0.12), 0 8px 16px rgba(0, 0, 0, 0.08);
}

.campaigns-table tbody tr {
    transition: background 0.2s ease, transform 0.3s ease;
    cursor: pointer;
}

.campaigns-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 106, 96, 0.05), rgba(0, 106, 96, 0.02)) !important;
    transform: translateX(4px);
}

.lead-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.3s ease;
    border: 2px solid transparent;
}

.lead-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 24px 48px rgba(0, 106, 96, 0.15), 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--md-sys-color-primary);
}

.pipeline-lead {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    cursor: pointer;
}

.pipeline-lead:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    background: linear-gradient(135deg, #fff 0%, var(--md-sys-color-surface-container) 100%);
}

/* Button Pulse & Filled Effect */
.btn-filled {
    position: relative;
    overflow: hidden;
}

.btn-filled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-filled:hover::before {
    width: 300px;
    height: 300px;
}

.action-btn {
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.15);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
}

/* ENTRANCE ANIMATIONS EXTENDED */
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.pipeline-column {
    animation: slideInLeft 0.5s ease-out backwards;
}
.pipeline-column:nth-child(1) { animation-delay: 0.1s; }
.pipeline-column:nth-child(2) { animation-delay: 0.2s; }
.pipeline-column:nth-child(3) { animation-delay: 0.3s; }
.pipeline-column:nth-child(4) { animation-delay: 0.4s; }

/* GRADIENT PROGRESS BARS */
.progress-bar {
    position: relative;
    overflow: hidden;
    background: rgba(0, 106, 96, 0.1);
}

.progress-fill {
    background: linear-gradient(90deg, #006A60 0%, #00897B 50%, #26A69A 100%);
    box-shadow: 0 0 12px rgba(0, 137, 123, 0.5);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* LIQUID GRADIENT TEXT */
.page-title-premium {
    background: linear-gradient(135deg, #006A60 0%, #00897B 25%, #4DB6AC 50%, #00897B 75%, #006A60 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: liquidGradient 4s ease infinite;
}

@keyframes liquidGradient {
    0% { background-position: 0% center; }
    50% { background-position: 100% center; }
    100% { background-position: 0% center; }
}

/* ROI & BADGE EFFECTS */
.roi-badge.excellent {
    box-shadow: 0 0 12px rgba(21, 87, 36, 0.4);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(21, 87, 36, 0.4); }
    50% { box-shadow: 0 0 20px rgba(21, 87, 36, 0.6); }
}

.status-badge.active::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #155724;
    border-radius: 50%;
    animation: statusPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(21, 87, 36, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(21, 87, 36, 0); }
}

.lead-score-badge.hot {
    animation: hotPulse 1.5s ease-in-out infinite;
}

@keyframes hotPulse {
    0%, 100% { background: var(--md-sys-color-error-container); box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
    50% { background: #FFCDD2; box-shadow: 0 0 12px 2px rgba(198, 40, 40, 0.3); }
}

/* SPARKLINE */
.sparkline-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: rgba(0, 106, 96, 0.05);
    border-radius: 8px;
}

.sparkline {
    width: 60px;
    height: 20px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.sparkline-bar {
    flex: 1;
    background: var(--md-sys-color-primary);
    border-radius: 2px 2px 0 0;
    opacity: 0.7;
    transition: opacity 0.2s ease, height 0.3s ease;
}

.sparkline-bar:hover { opacity: 1; }
.sparkline-trend { font: var(--md-sys-typescale-body-small); font-weight: 600; }
.sparkline-trend.up { color: #155724; }
.sparkline-trend.down { color: var(--md-sys-color-on-error-container, var(--md-sys-color-error)); }

/* QUICK ACTIONS */
.quick-actions { position: relative; }
.quick-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--md-sys-elevation-3);
    padding: 8px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}
.quick-actions:hover .quick-actions-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.quick-actions-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: background 0.2s ease;
}
.quick-actions-item:hover { background: var(--md-sys-color-surface-container); }
.quick-actions-item .material-symbols-outlined { font-size: 18px; color: var(--md-sys-color-on-surface-variant); }

/* SKELETON LOADING */
.skeleton {
    background: linear-gradient(90deg, var(--md-sys-color-surface-container) 25%, var(--md-sys-color-outline-variant) 50%, var(--md-sys-color-surface-container) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
