﻿/* =========================================================
   DASHBOARD PAGE
   Depends on dashboard-variables.css
   ========================================================= */

.dashboard-page,
.dashboard-page *,
.notification-overlay,
.notification-overlay * {
    box-sizing: border-box;
}

.dashboard-page {
    width: 100%;
    min-width: 0;
    padding: 30px;
    color: var(--db-text);
    background: var(--db-page);
}

.dashboard-title {
    position: relative;
    width: fit-content;
    margin: 0 0 30px;
    padding-bottom: 11px;
    color: var(--db-heading);
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 850;
    line-height: 1.2;
}

    .dashboard-title::after {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 58px;
        height: 4px;
        border-radius: var(--db-radius-round);
        background: linear-gradient(90deg, var(--db-primary), var(--db-primary-hover));
        content: "";
    }

/* =========================================================
   Dashboard cards
   ========================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 24px;
}

.dashboard-card,
.dashboard-card-alert {
    color: inherit !important;
    text-decoration: none !important;
}

.dashboard-card {
    position: relative;
    display: block;
    min-width: 0;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius-xl);
    color: var(--db-text) !important;
    background: radial-gradient(circle at 100% 0%, var(--db-primary-soft), transparent 34%), var(--db-surface);
    box-shadow: var(--db-shadow-md);
    transition: transform var(--db-transition), box-shadow var(--db-transition), border-color var(--db-transition);
}

    .dashboard-card::before {
        position: absolute;
        top: 0;
        left: 0;
        width: 5px;
        height: 100%;
        background: linear-gradient(180deg, var(--db-primary), var(--db-primary-hover));
        content: "";
        opacity: 0;
        transition: opacity var(--db-transition);
    }

    .dashboard-card::after {
        position: absolute;
        right: -45px;
        bottom: -65px;
        width: 140px;
        height: 140px;
        border: 1px solid var(--db-border);
        border-radius: 50%;
        content: "";
        opacity: 0.48;
        pointer-events: none;
    }

    .dashboard-card:hover {
        transform: translateY(-7px);
        border-color: var(--db-primary);
        box-shadow: var(--db-shadow-lg);
    }

        .dashboard-card:hover::before {
            opacity: 1;
        }

    .dashboard-card:visited,
    .dashboard-card:active,
    .dashboard-card:focus {
        color: inherit !important;
        text-decoration: none !important;
    }

.card-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 20px;
    border-radius: 18px;
    color: var(--db-primary);
    background: var(--db-primary-soft);
    font-size: 27px;
    transition: transform var(--db-transition), background var(--db-transition), color var(--db-transition);
}

.dashboard-card:hover .card-icon {
    color: var(--db-white);
    background: var(--db-primary);
    transform: scale(1.06) rotate(-2deg);
}

.card-title {
    position: relative;
    z-index: 1;
    margin: 0 0 10px;
    color: var(--db-heading);
    font-size: 21px;
    font-weight: 800;
    text-decoration: none !important;
}

.card-desc {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--db-muted);
    font-size: 14px;
    line-height: 1.65;
    text-decoration: none !important;
}

/* =========================================================
   Alert section
   ========================================================= */

.dashboard-card-alert {
    display: block;
    width: auto;
    min-width: 0;
    margin: 28px 0 0;
    padding: 22px;
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius-xl);
    background: var(--db-surface-glass);
    box-shadow: var(--db-shadow-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--db-border);
}

    .alert-header h2 {
        margin: 0;
        color: var(--db-heading);
        font-size: 19px;
        font-weight: 800;
    }

.alert-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: var(--db-radius-round);
    color: var(--db-white);
    background: var(--db-danger);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.22);
    font-size: 12px;
    font-weight: 850;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--db-border-soft);
    border-radius: var(--db-radius-lg);
    background: var(--db-surface);
    transition: transform var(--db-transition), box-shadow var(--db-transition), border-color var(--db-transition);
}

    .alert-item:hover {
        transform: translateY(-2px);
        border-color: var(--db-border-strong);
        box-shadow: var(--db-shadow-sm);
    }

.alert-icon {
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--db-radius-md);
    font-size: 18px;
}

.alert-item.warning .alert-icon {
    color: var(--db-warning);
    background: var(--db-warning-soft);
}

.alert-item.danger .alert-icon {
    color: var(--db-danger);
    background: var(--db-danger-soft);
}

.alert-item.info .alert-icon {
    color: var(--db-info);
    background: var(--db-info-soft);
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-title {
    margin-bottom: 3px;
    color: var(--db-heading);
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.alert-desc {
    color: var(--db-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.alert-time {
    flex: 0 0 auto;
    color: var(--db-muted-light);
    font-size: 11px;
    white-space: nowrap;
}

/* =========================================================
   Notification modal
   ========================================================= */

.notification-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    overflow-y: auto;
    background: var(--db-overlay);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.notification-modal {
    width: min(900px, 100%);
    max-height: calc(100dvh - 44px);
    overflow: hidden;
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius-2xl);
    background: var(--db-surface);
    box-shadow: var(--db-shadow-modal);
    display: flex;
    flex-direction: column;
    animation: dashboardModalOpen 0.24s ease;
}

.modal-header-custom {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 30px;
    overflow: hidden;
    color: var(--db-white);
    background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.10), transparent 36%), linear-gradient(135deg, var(--db-dark), var(--db-dark-2));
}

    .modal-header-custom::after {
        position: absolute;
        right: -55px;
        bottom: -90px;
        width: 180px;
        height: 180px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 50%;
        content: "";
    }

    .modal-header-custom > div:first-child,
    .modal-count {
        position: relative;
        z-index: 1;
    }

.modal-label {
    color: var(--db-dark-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.modal-header-custom h2 {
    margin: 8px 0;
    color: var(--db-white);
    font-size: clamp(27px, 4vw, 35px);
    font-weight: 900;
    line-height: 1.2;
}

.modal-header-custom p {
    margin: 0;
    color: var(--db-dark-text);
    line-height: 1.55;
}

.modal-count {
    flex: 0 0 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    color: var(--db-white);
    background: var(--db-danger);
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.28);
    font-size: 27px;
    font-weight: 900;
}

.modal-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    overflow-y: auto;
    background: var(--db-surface-soft);
}

.modal-alert-item {
    display: flex;
    gap: 16px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--db-border-soft);
    border-radius: var(--db-radius-xl);
    background: var(--db-surface);
    box-shadow: var(--db-shadow-sm);
    transition: transform var(--db-transition), box-shadow var(--db-transition);
}

    .modal-alert-item:hover {
        transform: translateY(-2px);
        box-shadow: var(--db-shadow-md);
    }

    .modal-alert-item.warning {
        border-color: var(--db-warning-border);
        background: var(--db-warning-panel);
    }

    .modal-alert-item.danger {
        border-color: var(--db-danger-border);
        background: color-mix(in srgb, var(--db-danger-soft) 56%, var(--db-surface));
    }

    .modal-alert-item.info {
        border-color: var(--db-info-border);
        background: var(--db-info-panel);
    }

    .modal-alert-item.read {
        border-color: var(--db-border);
        background: var(--db-surface-muted);
        opacity: 0.72;
    }

.modal-alert-icon {
    flex: 0 0 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border: 1px solid var(--db-border);
    border-radius: 17px;
    color: var(--db-primary);
    background: var(--db-surface);
    font-size: 25px;
}

.modal-alert-content {
    flex: 1;
    min-width: 0;
}

.modal-alert-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

    .modal-alert-top h3 {
        margin: 0 0 8px;
        color: var(--db-heading);
        font-size: 20px;
        font-weight: 850;
        overflow-wrap: anywhere;
    }

.modal-alert-content p {
    margin: 0 0 12px;
    color: var(--db-text-soft);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.modal-alert-time {
    color: var(--db-muted);
    font-size: 13px;
    font-weight: 750;
}

.modal-alert-status {
    flex: 0 0 auto;
    height: fit-content;
    padding: 7px 12px;
    border-radius: var(--db-radius-round);
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
}

    .modal-alert-status.unread {
        color: var(--db-danger-text);
        background: var(--db-danger-soft);
    }

    .modal-alert-status.read {
        color: var(--db-success-text);
        background: var(--db-success-soft);
    }

.read-btn,
.continue-btn {
    border: 0;
    color: var(--db-white);
    cursor: pointer;
    font-family: inherit;
    font-weight: 850;
    transition: transform var(--db-transition), background var(--db-transition), box-shadow var(--db-transition);
}

.read-btn {
    margin-top: 14px;
    padding: 11px 17px;
    border-radius: var(--db-radius-md);
    background: var(--db-dark);
}

    .read-btn:hover {
        background: var(--db-dark-hover);
        transform: translateY(-1px);
    }

.modal-footer-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-top: 1px solid var(--db-border);
    background: var(--db-surface);
}

    .modal-footer-custom span {
        color: var(--db-danger-text);
        font-weight: 850;
    }

.continue-btn {
    padding: 13px 24px;
    border-radius: var(--db-radius-lg);
    background: linear-gradient(135deg, var(--db-primary), var(--db-primary-hover));
    box-shadow: 0 8px 20px var(--db-primary-ring);
}

    .continue-btn:hover {
        transform: translateY(-1px);
        box-shadow: var(--db-shadow-md);
    }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
    .dashboard-page {
        padding: 22px;
    }

    .dashboard-grid {
        gap: 18px;
    }
}

@media (max-width: 650px) {
    .dashboard-page {
        padding: 16px;
    }

    .dashboard-title {
        margin-bottom: 22px;
    }

    .dashboard-card {
        padding: 22px;
        border-radius: var(--db-radius-lg);
    }

    .dashboard-card-alert {
        margin-top: 20px;
        padding: 16px;
        border-radius: var(--db-radius-lg);
    }

    .alert-item {
        align-items: flex-start;
    }

    .alert-time {
        display: none;
    }

    .notification-overlay {
        align-items: flex-start;
        padding: 10px;
    }

    .notification-modal {
        width: 100%;
        max-height: calc(100dvh - 20px);
        border-radius: var(--db-radius-lg);
    }

    .modal-header-custom {
        padding: 22px;
    }

    .modal-count {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
        border-radius: 16px;
        font-size: 22px;
    }

    .modal-list {
        padding: 14px;
    }

    .modal-alert-item {
        padding: 16px;
        border-radius: var(--db-radius-lg);
    }

    .modal-alert-top {
        flex-direction: column;
    }

    .modal-alert-status {
        width: fit-content;
    }

    .modal-footer-custom {
        align-items: stretch;
        flex-direction: column;
        padding: 14px;
    }

    .continue-btn {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .card-icon {
        width: 52px;
        height: 52px;
        font-size: 23px;
    }

    .modal-header-custom {
        gap: 14px;
        padding: 18px;
    }

        .modal-header-custom p {
            font-size: 13px;
        }

    .modal-alert-item {
        gap: 12px;
    }

    .modal-alert-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 14px;
        font-size: 21px;
    }

    .modal-alert-top h3 {
        font-size: 17px;
    }

    .modal-alert-content p {
        font-size: 13px;
    }
}

/* =========================================================
   Animation
   ========================================================= */

@keyframes dashboardModalOpen {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
