/* ============================================
   OmniSend  Main Stylesheet
   ============================================ */

/*  CSS Variables (Design Tokens)  */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --sidebar-width: 272px;
    --header-height: 64px;
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/*  Global Styles  */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

::selection {
    background: var(--primary);
    color: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/*  Glassmorphism  */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-card-light {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/*  Auth Background  */
.auth-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

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

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

@keyframes float-delayed {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, 20px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
    50% { box-shadow: 0 0 40px var(--primary-glow); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

.fade-in { animation: fadeIn 0.5s ease-out; }
.fade-in-up { animation: fadeInUp 0.5s ease-out; }
.fade-in-down { animation: fadeInDown 0.4s ease-out; }
.slide-in-right { animation: slideInRight 0.4s ease-out; }
.slide-in-left { animation: slideInLeft 0.4s ease-out; }
.scale-in { animation: scaleIn 0.3s ease-out; }
.animate-float { animation: float 8s ease-in-out infinite; }
.animate-float-delayed { animation: float-delayed 10s ease-in-out infinite 2s; }
.toast-enter { animation: toast-in 0.3s ease-out; }
.toast-exit { animation: toast-out 0.3s ease-in forwards; }

/* Staggered fade in for lists */
.stagger-fade > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.stagger-fade > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-fade > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-fade > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-fade > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-fade > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-fade > *:nth-child(6) { animation-delay: 0.3s; }

/*  Sidebar  */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    transition: transform var(--transition-normal);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.sidebar-link svg {
    flex-shrink: 0;
}

.sidebar-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    border-radius: 0 4px 4px 0;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    padding: 20px 16px 8px;
}

/*  Stat Cards  */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    padding: 24px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border-color: #c7d2fe;
}

.stat-card:hover::after {
    opacity: 1;
}

.dark .stat-card {
    background: #1e293b;
    border-color: #334155;
}

.dark .stat-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    border-color: #4f46e5;
}

/*  Input Fields  */
.form-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: #1e293b;
    background: white;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
}

/* Auth input (dark theme) */
.auth-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: #ffffff;
    transition: all var(--transition-fast);
    outline: none;
}

.auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/*  Buttons  */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
    outline: none;
    border: 1px solid transparent;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.45);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #475569;
    border: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.dark .btn-secondary {
    background: rgba(30, 41, 59, 0.6);
    color: #e2e8f0;
    border: 1px solid rgba(51, 65, 85, 0.6);
}

.btn-secondary:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.dark .btn-secondary:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: #475569;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.btn-ghost {
    background: transparent;
    color: #64748b;
}

.btn-ghost:hover {
    background: rgba(241, 245, 249, 0.8);
    color: #1e293b;
}

.dark .btn-ghost:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #f8fafc;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius-xl);
}

/*  Toast Notifications  */
.toast {
    min-width: 320px;
    max-width: 420px;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
}

.toast-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.95));
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
    color: white;
}

/*  Loading Skeleton  */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/*  Badge  */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

/*  Data Table  */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

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

.data-table tbody tr:hover {
    background: #f8fafc;
}

.dark .data-table th {
    background: #0f172a;
    border-color: #1e293b;
    color: #94a3b8;
}

.dark .data-table td {
    color: #e2e8f0;
    border-color: #1e293b;
}

.dark .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/*  Modal  */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    animation: scaleIn 0.3s ease-out;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
}

.dark .modal-content {
    background: #1e293b;
    border: 1px solid #334155;
}

/*  Empty State  */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    display: flex;
    align-items: center;
    justify-content: center;
}

/*  Utility  */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gradient-text {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Collapsed Sidebar (Desktop) ────────── */
body.sidebar-collapsed .sidebar {
    width: 80px;
}
body.sidebar-collapsed #main-content {
    margin-inline-start: 80px !important;
}
body.sidebar-collapsed .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    display: none;
}
body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 10px;
}
body.sidebar-collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}
body.sidebar-collapsed .sidebar-logo-text {
    display: none;
}
body.sidebar-collapsed .sidebar-dropdown-icon {
    display: none;
}