/**
 * Norphis.com - Design System
 * Brand Theme: Trusted Affiliate Platform
 * Palette: Midnight + Blue + Green (Performance & Trust)
 */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    /* Norphis Brand Colors */
    --midnight: #0B1220;          /* Primary - Trust & Infrastructure */
    --blue: #2563EB;              /* Action - CTAs, Links, Performance */
    --green: #22C55E;             /* Payout - Success, Money, Approved */
    --slate: #64748B;             /* Text Secondary */
    --cloud: #F1F5F9;             /* Background */
    --white: #FFFFFF;

    /* UI States */
    --warning: #F59E0B;           /* Pending, Attention */
    --error: #EF4444;             /* Rejected, Problems */
    --info: #06B6D4;              /* Info, Neutral */

    /* Derived Colors */
    --blue-hover: #1D4ED8;
    --green-hover: #16A34A;
    --midnight-light: #1E293B;
    --border: #E2E8F0;
    --border-dark: #CBD5E1;

    /* Text on dark backgrounds */
    --text-on-dark: #F8FAFC;
    --text-on-dark-secondary: #CBD5E1;

    /* Typography */
    --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing & Radius */
    --radius: 8px;
    --radius-lg: 12px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-ui);
    background: var(--cloud);
    color: var(--midnight);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--blue-hover);
    text-decoration: underline;
}

/* Typography - Manrope for headings */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.3;
    color: var(--midnight);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

.text-secondary { color: var(--slate); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-ui);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--blue-hover);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--midnight);
    border: 1px solid var(--border-dark);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--cloud);
    border-color: var(--slate);
    color: var(--midnight);
}

.btn-success {
    background: var(--green);
    color: var(--white);
}

.btn-success:hover:not(:disabled) {
    background: var(--green-hover);
    color: var(--white);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover:not(:disabled) {
    background: #D97706;
    color: var(--white);
}

/* Links styled as buttons - prevent link hover from overriding */
a.btn {
    text-decoration: none;
}

a.btn:hover {
    text-decoration: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--midnight);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: var(--font-ui);
    color: var(--midnight);
    background: var(--white);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--slate);
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--slate);
    cursor: pointer;
}

.form-check input {
    accent-color: var(--blue);
}

/* Input with icon */
.input-wrapper {
    position: relative;
}

.input-wrapper .form-input {
    padding-left: 2.5rem;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate);
    pointer-events: none;
}

.input-action {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--slate);
    cursor: pointer;
    padding: 0.25rem;
}

.input-action:hover {
    color: var(--midnight);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Stat Card - Special styling for metrics */
.stat-card {
    padding: 1.25rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--midnight);
}

.stat-value.money {
    color: var(--green);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--slate);
    margin-top: 0.25rem;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate);
    background: var(--cloud);
}

.table tbody tr:hover {
    background: var(--cloud);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges - Status indicators */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: 9999px;
}

/* Active/Approved - GREEN (payout/trust) */
.badge-active,
.badge-approved,
.badge-paid {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
}

/* Pending - WARNING (attention needed) */
.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Inactive/Suspended - SLATE */
.badge-inactive,
.badge-suspended {
    background: var(--cloud);
    color: var(--slate);
}

/* Rejected/Error - ERROR */
.badge-error,
.badge-rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Info badge */
.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #B45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: #0E7490;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Layout - Sidebar with Midnight background */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--midnight);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-on-dark);
    letter-spacing: -0.02em;
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    background: var(--blue);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-on-dark-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

@media (min-width: 1024px) {
    .sidebar-close {
        display: none;
    }
}

.sidebar-nav {
    padding: 0.75rem 0;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-label {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-on-dark-secondary);
    opacity: 0.6;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    margin: 0 0.5rem;
    font-size: 0.875rem;
    color: var(--text-on-dark-secondary);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-on-dark);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--blue);
    color: var(--white);
}

.sidebar-link i {
    width: 1.25rem;
    text-align: center;
    opacity: 0.9;
}

/* Sidebar User Section */
.sidebar-user {
    padding: 1rem;
    margin: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.875rem;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-on-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-on-dark-secondary);
    opacity: 0.7;
}

/* Main */
.main {
    flex: 1;
    min-height: 100vh;
    background: var(--cloud);
}

@media (min-width: 1024px) {
    .main {
        margin-left: 260px;
    }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.topbar-toggle {
    background: none;
    border: none;
    color: var(--midnight);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.75rem;
}

@media (min-width: 1024px) {
    .topbar-toggle {
        display: none;
    }
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--midnight);
}

.content {
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .content {
        padding: 2rem;
    }
}

/* Auth Pages */
.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--midnight) 0%, var(--midnight-light) 100%);
}

.auth-box {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--midnight);
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.auth-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--blue);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
}

.auth-title {
    font-family: var(--font-display);
    text-align: center;
    margin-bottom: 0.375rem;
    color: var(--midnight);
}

.auth-subtitle {
    text-align: center;
    color: var(--slate);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--slate);
    font-size: 0.875rem;
}

/* Trust indicators for auth pages */
.auth-trust {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.auth-trust-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--slate);
}

.auth-trust-item i {
    color: var(--green);
}

/* Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1023px) {
    .cols-4, .cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
    .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }

/* Avatar */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--blue);
    color: var(--white);
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.avatar:hover {
    opacity: 0.9;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s;
    z-index: 100;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--slate);
    cursor: pointer;
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: var(--cloud);
    color: var(--midnight);
    text-decoration: none;
}

.dropdown-header {
    padding: 0.5rem 1rem;
}

.dropdown-divider {
    height: 1px;
    margin: 0.375rem 0;
    background: var(--border);
}

.font-medium { font-weight: 500; }
.hidden { display: none !important; }

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: var(--green);
    color: var(--white);
}

.toast-error {
    background: var(--error);
    color: var(--white);
}

.toast-warning {
    background: var(--warning);
    color: var(--white);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--slate);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--midnight);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Scrollbar - Subtle style */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate);
}

/* Focus - Accessibility */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Money highlight - Green for payouts */
.money {
    color: var(--green);
    font-weight: 600;
}

.money-lg {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green);
}

/* Section headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--midnight);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 1024px) {
    .sidebar-overlay {
        display: none;
    }
}

/* Link copy button styling */
.link-copy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--cloud);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--midnight);
    cursor: pointer;
    transition: all 0.15s;
}

.link-copy:hover {
    background: var(--white);
    border-color: var(--blue);
}

.link-copy code {
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
    color: var(--blue);
}

/* Captcha styling */
.captcha-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--cloud);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.captcha-question {
    flex: 1;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--midnight);
}

.captcha-refresh {
    background: none;
    border: none;
    color: var(--slate);
    cursor: pointer;
    padding: 0.25rem;
}

.captcha-refresh:hover {
    color: var(--blue);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--midnight);
}

.modal-close {
    background: none;
    border: none;
    color: var(--slate);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--midnight);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}
