/* ============================================
   SLOXLY — Dashboard Stylesheet
   SaaS Redesign (Stripe/Vercel/LemonSqueezy)
   All colors from theme CSS variables
   ============================================ */

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    background: var(--bg);
}

/* Dashboard Content Area */
.dashboard-content {
    flex: 1;
    padding: 32px 36px;
    max-width: 1140px;
    min-width: 0;
}

/* Welcome Header */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.02em;
}

.dashboard-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   STAT CARDS — Geometric / Cut Corner
   ============================================ */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 24px 22px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;

    /* Cut corner shape — top-right */
    border-radius: 12px 0 12px 12px;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
}

/* Diagonal accent line */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    transition: opacity 0.2s ease;
}

.stat-card.purple::before {
    background: var(--primary);
}

.stat-card.green::before {
    background: var(--success);
}

.stat-card.blue::before {
    background: var(--info);
}

.stat-card.orange::before {
    background: var(--warning);
}

/* Left accent bar */
.stat-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

.stat-card.purple::after {
    background: var(--primary);
}

.stat-card.green::after {
    background: var(--success);
}

.stat-card.blue::after {
    background: var(--info);
}

.stat-card.orange::after {
    background: var(--warning);
}

/* Hover */
.stat-card:hover {
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

.stat-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    color: var(--text-secondary);
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover .stat-card-icon {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--card));
    border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
}

.stat-card-value {
    font-size: 1.65rem;
    font-weight: 900;
    color: var(--heading);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-card-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================
   GRID LAYOUT
   ============================================ */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* ============================================
   PANEL / TABLE WRAPPER — Slanted Header
   ============================================ */
.dash-table-wrapper {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    transition: border-color 0.2s ease;
}

.dash-table-wrapper:hover {
    border-color: var(--text-secondary);
}

.dash-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

/* Subtle diagonal separator */
.dash-table-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: 0;
    width: 60px;
    height: 1px;
    background: var(--primary);
}

.dash-table-header h3 {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.dash-empty {
    text-align: center;
    padding: 48px 20px;
}

.dash-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px 0 16px 16px;
    background: var(--surface);
    color: var(--text-secondary);
}

.dash-empty h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0 0 6px;
}

.dash-empty p {
    color: var(--text-secondary);
    font-size: 0.86rem;
    margin: 0 0 20px;
}

/* ============================================
   ORDER / PURCHASE CARD
   ============================================ */
.order-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.order-card:hover {
    background: var(--surface);
}

.order-card:last-child {
    border-bottom: none;
}

.order-thumb {
    width: 52px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.order-info {
    flex: 1;
    min-width: 0;
}

.order-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.order-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================
   LICENSE KEY DISPLAY
   ============================================ */
.license-key-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text);
}

.license-key-box .copy-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--primary);
    color: var(--btn-text);
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.license-key-box .copy-btn:hover {
    background: var(--primary-hover);
}

/* ============================================
   NOTIFICATION ITEM
   ============================================ */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.notif-item.unread {
    background: color-mix(in srgb, var(--primary) 4%, var(--card));
    border-left: 3px solid var(--primary);
}

.notif-item:hover {
    background: var(--surface);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface);
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.notif-item:hover .notif-icon {
    color: var(--primary);
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-text {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text);
}

.notif-time {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* ============================================
   PROFILE FORM SECTIONS
   ============================================ */
.profile-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.profile-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

/* ============================================
   TICKET STYLING
   ============================================ */
.ticket-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.ticket-card:hover {
    background: var(--surface);
}

.ticket-card:last-child {
    border-bottom: none;
}

.ticket-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticket-priority.high {
    background: var(--danger);
}

.ticket-priority.medium {
    background: var(--warning);
}

.ticket-priority.low {
    background: var(--success);
}

.ticket-info {
    flex: 1;
    min-width: 0;
}

.ticket-subject {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.ticket-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================
   LOAD ANIMATION
   ============================================ */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-content {
    animation: fadeSlideIn 0.4s ease forwards;
}

.stat-card {
    animation: fadeSlideIn 0.4s ease both;
}

.stat-card:nth-child(1) {
    animation-delay: 0.05s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.2s;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .dashboard-content {
        padding: 20px 16px;
    }

    .stat-cards {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dashboard-title {
        font-size: 1.25rem;
    }

    .order-card {
        flex-direction: column;
        align-items: flex-start;
    }
}