/* OnlyProfit Admin - Global Styles */

/* ========== Base & Typography ========== */
body {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Scrollbar Styling ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background-color: rgba(128, 128, 128, 0.35);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(128, 128, 128, 0.55);
}

/* ========== App Header ========== */
.app-header {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    backdrop-filter: blur(10px);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.app-brand-tile {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6C63F0 0%, #22D3EE 120%);
    box-shadow: 0 2px 10px rgba(108, 99, 240, 0.35);
    flex-shrink: 0;
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.app-brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.app-brand-sub {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
}

.app-header .search-field {
    max-width: 300px;
    min-width: 190px;
}

.app-header .search-field .mud-input-outlined {
    border-radius: 10px;
    background-color: rgba(128, 128, 128, 0.07);
}

.app-header .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--mud-palette-lines-default) !important;
}

.app-header .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--mud-palette-primary) !important;
}

/* Live status chip */
.live-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
    user-select: none;
}

.live-chip.live {
    color: var(--mud-palette-success);
    background: rgba(63, 185, 80, 0.1);
    border-color: rgba(63, 185, 80, 0.25);
}

.live-chip.offline {
    color: var(--mud-palette-error);
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.25);
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.live-chip.live .live-dot {
    animation: pulse 2s infinite;
    box-shadow: 0 0 6px currentColor;
}

.user-avatar {
    background: linear-gradient(135deg, #6C63F0 0%, #22D3EE 120%);
    color: #fff !important;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

/* ========== Drawer / NavMenu ========== */
.mud-drawer {
    border-right: 1px solid var(--mud-palette-lines-default);
}

.mud-drawer.mud-drawer-right {
    border-left: 1px solid var(--mud-palette-lines-default);
}

.app-nav .mud-nav-link {
    border-radius: 8px !important;
    margin: 1px 10px !important;
    padding: 7px 12px !important;
    font-size: 0.875rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
}

.app-nav .mud-nav-link .mud-nav-link-icon {
    font-size: 1.25rem;
}

.app-nav .mud-nav-link:hover {
    background-color: rgba(128, 128, 128, 0.08);
}

.app-nav .mud-nav-link.active {
    font-weight: 600;
    color: var(--mud-palette-primary) !important;
    background-color: rgba(var(--mud-palette-primary-rgb), 0.1) !important;
}

.app-nav .mud-nav-link.active .mud-nav-link-icon {
    color: var(--mud-palette-primary) !important;
}

.app-nav .mud-nav-link.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--mud-palette-primary);
}

.nav-section-label {
    padding: 18px 22px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
}

/* Hide section labels in mini drawer */
.mud-drawer-mini .nav-section-label {
    visibility: hidden;
    padding-top: 10px;
    padding-bottom: 0;
    height: 12px;
}

/* ========== Page Headers ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
    border: 1px solid rgba(var(--mud-palette-primary-rgb), 0.2);
    flex-shrink: 0;
}

.page-header-heading {
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.page-header-subtitle {
    color: var(--mud-palette-text-secondary);
    margin-top: 1px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== Cards & Papers ========== */
.mud-paper {
    border-radius: 12px !important;
}

.mud-paper.mud-elevation-1,
.mud-paper.mud-elevation-2,
.mud-paper.mud-elevation-3 {
    box-shadow: none !important;
    border: 1px solid var(--mud-palette-lines-default);
}

.mud-card {
    border-radius: 12px !important;
}

.hoverable-card,
.stats-card,
.chart-card {
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hoverable-card:hover,
.stats-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--mud-palette-primary-rgb), 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.chart-card:hover {
    border-color: rgba(var(--mud-palette-primary-rgb), 0.35);
}

/* ========== Stats Cards ========== */
.stats-card {
    height: 100%;
}

.stats-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.stats-value {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stats-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stats-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.stats-trend.up {
    color: var(--mud-palette-success);
    background: rgba(63, 185, 80, 0.12);
}

.stats-trend.down {
    color: var(--mud-palette-error);
    background: rgba(248, 81, 73, 0.12);
}

.stats-card .mud-chart {
    opacity: 0.65;
    transition: opacity 0.2s ease;
}

.stats-card:hover .mud-chart {
    opacity: 1;
}

/* ========== Tables ========== */
.mud-table {
    border-radius: 12px;
}

.mud-table .mud-table-head .mud-table-cell,
.mud-data-grid .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mud-palette-text-secondary);
    background-color: rgba(128, 128, 128, 0.045);
}

.mud-table-row:hover {
    transition: background-color 0.15s ease-in-out;
}

.mud-table .mud-table-toolbar {
    padding-left: 16px;
    padding-right: 16px;
}

/* ========== Chips ========== */
.mud-chip {
    font-weight: 500;
}

/* ========== Dialogs ========== */
.mud-dialog .mud-dialog-content {
    padding-top: 16px;
}

.mud-dialog {
    border-radius: 16px !important;
    border: 1px solid var(--mud-palette-lines-default);
}

.mud-dialog .mud-dialog-title {
    font-weight: 600;
}

/* ========== Dashboard Panels ========== */
.dashboard-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-panel .mud-list,
.dashboard-panel .mud-timeline,
.dashboard-panel .d-flex.flex-column {
    flex: 1;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

/* ========== Heatmap ========== */
.heatmap-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
}

.heatmap-table th {
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
    padding: 4px 0;
}

.heatmap-table td.heatmap-day-label {
    font-size: 12px;
    font-weight: 600;
    padding-right: 8px;
    white-space: nowrap;
    color: var(--mud-palette-text-secondary);
}

.heatmap-cell {
    height: 28px;
    min-width: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.heatmap-cell:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
    position: relative;
}

.heatmap-cell span {
    font-size: 9px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

/* ========== Platform Metrics ========== */
.metric-value {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.metric-label {
    font-size: 0.875rem;
    margin-top: 4px;
}

/* ========== Filter Bar ========== */
.filter-bar {
    flex-wrap: wrap;
    gap: 12px;
}

/* ========== Empty States ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--mud-palette-text-secondary);
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid var(--mud-palette-lines-default);
}

.empty-state-title {
    font-weight: 600 !important;
}

.empty-state-description {
    max-width: 420px;
    margin-top: 4px;
}

/* ========== Loading States ========== */
.mud-skeleton {
    border-radius: 10px !important;
}

/* ========== Status Indicators ========== */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--mud-palette-success);
    box-shadow: 0 0 8px var(--mud-palette-success);
}

.status-dot.offline {
    background-color: var(--mud-palette-grey-default);
}

/* ========== Monospace for IDs ========== */
.monospace {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* ========== Animations ========== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

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

.pulse-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.new-record {
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% { background-color: rgba(var(--mud-palette-primary-rgb), 0.3); }
    100% { background-color: transparent; }
}

.new-record-success {
    animation: highlight-success 2s ease-out;
}

@keyframes highlight-success {
    0% { background-color: rgba(var(--mud-palette-success-rgb), 0.3); }
    100% { background-color: transparent; }
}

.new-record-error {
    animation: highlight-error 2s ease-out;
}

@keyframes highlight-error {
    0% { background-color: rgba(var(--mud-palette-error-rgb), 0.3); }
    100% { background-color: transparent; }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

.badge-pulse {
    animation: badge-pulse 1s infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.count-up {
    display: inline-block;
}

/* ========== Login Page ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    background: #0B0D12;
    color: #ECEFF6;
}

.login-brand {
    flex: 1.15;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 72px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 50% at 20% 20%, rgba(108, 99, 240, 0.28), transparent),
        radial-gradient(ellipse 50% 40% at 80% 85%, rgba(34, 211, 238, 0.14), transparent),
        #0B0D12;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 80% 70% at 40% 40%, #000 30%, transparent 75%);
    pointer-events: none;
}

.login-brand-inner {
    position: relative;
    max-width: 460px;
}

.login-brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 40px;
}

.login-brand-tile {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6C63F0 0%, #22D3EE 120%);
    box-shadow: 0 4px 24px rgba(108, 99, 240, 0.45);
}

.login-brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-brand-title {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 14px;
}

.login-brand-title .accent {
    background: linear-gradient(90deg, #837DFF, #22D3EE);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-brand-desc {
    font-size: 0.95rem;
    color: #97A0B0;
    line-height: 1.6;
    margin-bottom: 36px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: #C9D1DC;
    font-size: 0.9rem;
}

.login-feature-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #837DFF;
    background: rgba(131, 125, 255, 0.12);
    border: 1px solid rgba(131, 125, 255, 0.22);
    flex-shrink: 0;
}

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.login-form-inner {
    width: 100%;
    max-width: 380px;
}

.login-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.login-form-subtitle {
    color: #97A0B0;
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.login-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.75rem;
    color: #5B6472;
}

@media (max-width: 900px) {
    .login-brand {
        display: none;
    }
}

/* ========== Responsive ========== */
@media (max-width: 960px) {
    .mud-appbar .search-field {
        display: none;
    }

    .app-brand-sub {
        display: none;
    }
}

@media (max-width: 600px) {
    .mud-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .mud-appbar .live-chip {
        display: none;
    }
}

/* ========== Cursor Utilities ========== */
.cursor-pointer {
    cursor: pointer;
}

.cursor-pointer:hover {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.04) !important;
}

/* ========== Misc ========== */
.text-right {
    text-align: right;
}

.font-weight-bold {
    font-weight: 600 !important;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Selection highlight for code/monospace */
.mud-paper pre::selection,
.monospace::selection {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.3);
}
