// ==========================================================================
// PressZone Theme - Dashboard Styles
// ==========================================================================
// Entry point - compiles to dashboard.css
// Uses Sass variables with body.dark-mode & nesting pattern.
// ==========================================================================

@import 'abstracts/variables';
@import 'abstracts/mixins';

// --------------------------------------------------------------------------
// Dashboard Wrapper
// --------------------------------------------------------------------------
.presszone-dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: $light-bg-primary;

    body.dark-mode & {
        background: #0f1419;
    }
}

// --------------------------------------------------------------------------
// Sidebar
// --------------------------------------------------------------------------
.presszone-dashboard-sidebar {
    width: 280px;
    background: $light-bg-secondary;
    border-left: 1px solid $light-border-color;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;

    body.dark-mode & {
        background: $dark-bg-primary;
        border-left-color: $dark-border-color;
    }

    @include rtl {
        border-left: none;
        border-right: 1px solid $light-border-color;

        body.dark-mode & {
            border-right-color: $dark-border-color;
        }
    }

    @include media-down(lg) {
        position: fixed;
        left: -280px;
        z-index: 1000;
        transition: left 0.3s ease;

        &.open {
            left: 0;
        }
    }
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid $light-border-color;
    margin-bottom: 0.75rem;

    body.dark-mode & {
        border-bottom-color: $dark-border-color;
    }
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid $light-border-color;

    body.dark-mode & {
        border-color: $dark-border-color;
    }
}

.sidebar-user-name {
    font-weight: 600;
    color: $light-text-primary;
    display: block;

    body.dark-mode & {
        color: #fff;
    }
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: $color-primary;
    background: rgba($color-primary, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.sidebar-date {
    text-align: center;
    padding: 0.75rem;
    background: $light-bg-tertiary;
    border-radius: 0.5rem;
    margin-bottom: 1rem;

    span {
        display: block;
        font-size: 0.875rem;
        color: $light-text-primary;

        body.dark-mode & {
            color: #fff;
        }
    }

    small {
        font-size: 0.6875rem;
        color: $light-text-muted;

        body.dark-mode & {
            color: $dark-text-muted;
        }
    }

    body.dark-mode & {
        background: $dark-bg-tertiary;
    }
}

// Sidebar Nav
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: $light-text-secondary;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;

    &:hover {
        background: $light-bg-tertiary;
        color: $light-text-primary;
    }

    &.active {
        background: $color-primary;
        color: $dark-bg-primary;
        font-weight: 600;
    }

    i {
        font-size: 1.125rem;
    }

    body.dark-mode & {
        color: #9ca3af;

        &:hover {
            background: $dark-bg-tertiary;
            color: #fff;
        }
    }

    @include rtl {
        text-align: right;
    }
}

// Sidebar Footer
.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid $light-border-color;

    body.dark-mode & {
        border-top-color: $dark-border-color;
    }
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: $light-bg-tertiary;
    border: 1px solid $light-border-color;
    border-radius: 0.5rem;
    color: $light-text-secondary;
    text-decoration: none;
    transition: all 0.2s ease;

    &:hover {
        background: rgba($color-danger, 0.1);
        border-color: rgba($color-danger, 0.3);
        color: $color-danger;
    }

    body.dark-mode & {
        background: $dark-bg-tertiary;
        border-color: $dark-border-color;
        color: #9ca3af;
    }
}

// --------------------------------------------------------------------------
// Main Content
// --------------------------------------------------------------------------
.presszone-dashboard-main {
    flex: 1;
    padding: 2rem;
    overflow-x: hidden;

    @include media-down(md) {
        padding: 1rem;
    }

    @include media-down(lg) {
        margin-right: 0;
    }
}

// Breadcrumb
.presszone-dashboard-breadcrumb {
    font-size: 0.875rem;
    color: $light-text-muted;
    margin-bottom: 1.5rem;

    a {
        color: $light-text-secondary;
        text-decoration: none;

        &:hover {
            color: $color-primary;
        }
    }

    .separator {
        margin: 0 0.5rem;
    }

    .current-section {
        color: $light-text-primary;

        body.dark-mode & {
            color: #fff;
        }
    }

    body.dark-mode & {
        color: $dark-text-muted;

        a {
            color: $dark-text-secondary;
        }
    }
}

// Sections
.presszone-dashboard-section {
    display: none;

    &.active {
        display: block;
    }
}

// --------------------------------------------------------------------------
// Section Header
// --------------------------------------------------------------------------
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;

    @include media-down(lg) {
        flex-direction: column;
    }
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: $light-text-primary;
    margin: 0 0 0.5rem 0;

    body.dark-mode & {
        color: #fff;
    }

    @include media-down(md) {
        font-size: 1.5rem;
    }
}

.section-subtitle {
    color: $light-text-secondary;
    margin: 0;
    max-width: 500px;

    body.dark-mode & {
        color: $dark-text-secondary;
    }
}

.section-actions {
    display: flex;
    gap: 0.5rem;
}

// --------------------------------------------------------------------------
// Stat Cards (Dashboard specific)
// --------------------------------------------------------------------------
.overview-stats,
.subscription-stats,
.invoice-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;

    @include media-down(md) {
        grid-template-columns: 1fr;
    }
}

.presszone-stat-card {
    background: $light-bg-card;
    border: 1px solid $light-border-color;
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;

    &.stat-primary {
        border-color: rgba($color-primary, 0.3);
        background: linear-gradient(135deg, rgba($color-primary, 0.1) 0%, $light-bg-card 100%);

        body.dark-mode & {
            background: linear-gradient(135deg, rgba($color-primary, 0.1) 0%, $dark-bg-tertiary 100%);
        }
    }

    body.dark-mode & {
        background: $dark-bg-tertiary;
        border-color: $dark-border-color;
    }
}

.presszone-stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba($color-primary, 0.1);
    border-radius: 0.5rem;
    color: $color-primary;
    font-size: 1.25rem;

    &.warning {
        background: rgba($color-secondary, 0.1);
        color: $color-secondary;
    }
}

.presszone-stat-content {
    flex: 1;
}

.presszone-stat-label {
    display: block;
    font-size: 0.75rem;
    color: $light-text-muted;
    margin-bottom: 0.25rem;

    body.dark-mode & {
        color: $dark-text-muted;
    }
}

.presszone-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: $light-text-primary;

    body.dark-mode & {
        color: #fff;
    }
}

// --------------------------------------------------------------------------
// Activity Table
// --------------------------------------------------------------------------
.overview-activity,
.invoice-table-wrap {
    background: $light-bg-card;
    border: 1px solid $light-border-color;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 2rem;

    body.dark-mode & {
        background: $dark-bg-tertiary;
        border-color: $dark-border-color;
    }
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid $light-border-color;

    body.dark-mode & {
        border-bottom-color: $dark-border-color;
    }
}

.activity-title {
    font-size: 1rem;
    font-weight: 600;
    color: $light-text-primary;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    body.dark-mode & {
        color: #fff;
    }
}

.activity-view-all {
    font-size: 0.875rem;
    color: $color-primary;
    text-decoration: none;

    &:hover {
        text-decoration: underline;
    }
}

.activity-table,
.invoice-table {
    width: 100%;
    border-collapse: collapse;

    th {
        text-align: right;
        padding: 0.75rem 1.25rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: $light-text-muted;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        background: $light-bg-secondary;

        body.dark-mode & {
            background: $dark-bg-secondary;
            color: $dark-text-muted;
        }

        @include rtl {
            text-align: right;
        }
    }

    td {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid $light-border-color;
        font-size: 0.875rem;
        color: $light-text-secondary;

        body.dark-mode & {
            border-bottom-color: $dark-border-color;
            color: $dark-text-secondary;
        }
    }

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

// Status Badges
.activity-status,
.invoice-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;

    &.status-completed,
    &.status-paid {
        background: rgba($color-success, 0.1);
        color: $color-success;
    }

    &.status-pending {
        background: rgba($color-secondary, 0.1);
        color: $color-secondary;
    }

    &.status-cancelled {
        background: rgba($color-danger, 0.1);
        color: $color-danger;
    }
}

// --------------------------------------------------------------------------
// Dashboard Footer
// --------------------------------------------------------------------------
.presszone-dashboard-footer {
    padding: 1rem 2rem;
    text-align: center;
    color: $light-text-muted;
    font-size: 0.75rem;
    background: $light-bg-secondary;

    body.dark-mode & {
        background: #0f1419;
        color: $dark-text-muted;
    }
}
