/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1e38 50%, #090d16 100%);
    --panel-bg: rgba(30, 41, 59, 0.45);
    --panel-border: rgba(255, 255, 255, 0.07);
    --panel-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #475569;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

/* Sidebar styling */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--panel-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 8px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-area h2 {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn svg {
    transition: transform 0.3s ease;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.nav-btn:hover svg {
    transform: translateX(2px);
}

.nav-btn.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.app-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Notification banner */
.notification-box {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease;
}

.notification-box.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

.notification-box.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.notification-box.info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-block {
    width: 100%;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
}

.btn-text:hover {
    color: #818cf8;
    text-decoration: underline;
}

.sync-icon {
    animation: none;
}

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Content Body & Panes */
.content-body {
    flex-grow: 1;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

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

/* Glass panel wrappers */
.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: var(--panel-glow);
}

/* Dashboard elements */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--panel-glow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.card-icon.purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.card-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.card-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.stat-details {
    display: flex;
    flex-direction: column;
}

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

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
}

.dashboard-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--panel-glow);
}

.panel-header {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.action-item:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateX(4px);
}

.action-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.action-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.action-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.25s ease;
}

.action-item:hover .action-arrow {
    color: var(--primary);
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.info-content {
    font-weight: 500;
    font-size: 0.9rem;
}

.border-none { border: none !important; }
.font-sm { font-size: 0.8rem !important; }
.mt-6 { margin-top: 1.5rem; }

/* Panel Containers */
.panel-container {
    padding: 2rem;
    margin: 0 auto;
    width: 100%;
}

.max-w-lg {
    max-width: 750px;
}

.panel-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.panel-container p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Forms */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.required {
    color: var(--danger);
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.25s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

/* Button Group Toggle */
.btn-group-toggle {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.2rem;
}

.btn-group-toggle input[type="radio"] {
    display: none;
}

.btn-group-toggle label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
    margin: 0;
}

.btn-group-toggle input[type="radio"]:checked + label {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sender Layout */
.sender-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: calc(100vh - 160px);
}

.sender-config,
.sender-targets {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sender-config h3,
.sender-targets h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.sender-config form {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.search-bar {
    width: 60%;
    margin-bottom: 0.5rem;
}

.search-bar input {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.tab-sub-nav {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.sub-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.sub-tab-btn:hover {
    color: var(--text-main);
}

.sub-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Checkbox Container */
.checkbox-container {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-info {
    display: flex;
    flex-direction: column;
}

.checkbox-title {
    font-size: 0.9rem;
    font-weight: 500;
}

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

.selection-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.empty-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem;
    margin: auto 0;
}

/* Checkbox group wrapper for forms */
.checkbox-group-wrapper {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
}

.checkbox-group-wrapper .search-bar {
    width: 100%;
}

.h-80 {
    height: 180px !important;
}

/* Logs and Tables */
.logs-container {
    display: flex;
    flex-direction: column;
}

.logs-section {
    padding: 1.5rem;
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
    margin-top: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table th {
    background: rgba(15, 23, 42, 0.6);
    font-weight: 600;
    color: var(--text-muted);
}

.data-table td {
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

/* Helpers */
.hidden {
    display: none !important;
}

/* Custom Glassmorphism Switch Slider Component */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.switch input:checked + .slider {
    background-color: var(--primary) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}

.switch input:checked + .slider::before {
    transform: translateX(22px);
}

/* Smaller switches inside the rules data-table */
.data-table .switch {
    width: 34px !important;
    height: 18px !important;
}

.data-table .switch .slider::before {
    height: 12px !important;
    width: 12px !important;
    left: 2px !important;
    bottom: 2px !important;
}

.data-table .switch input:checked + .slider::before {
    transform: translateX(16px) !important;
}
