/* css/dashboard.css — Attendance Dashboard specific styles */

/* ── Header extras ── */
.header-center {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.device-name {
    font-size: 1rem;
    font-weight: 600;
    opacity: .9;
}

.header-right {
    display: flex;
    align-items: center;
    gap: .8rem;
}

/* ── Metrics bar ── */
.metrics-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    text-align: center;
    transition: .3s;
}

.metric-card:hover {
    border-color: var(--secondary);
    transform: translateY(-2px);
}

.metric-val {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.metric-lbl {
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: .45;
    margin-top: .35rem;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, .3);
    padding: .4rem;
    border-radius: 14px;
    width: fit-content;
}

.tab-btn {
    padding: .6rem 1.6rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .55);
    font-weight: 600;
    cursor: pointer;
    transition: .25s;
    font-size: .9rem;
}

.tab-btn.active {
    background: var(--secondary);
    color: var(--bg);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ── Attendance controls ── */
.att-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.2rem 1.5rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.date-nav button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: .5rem .9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: .2s;
}

.date-nav button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

input[type="date"] {
    width: auto;
}

.att-summary {
    font-size: .85rem;
    opacity: .55;
    margin-left: auto;
}

/* ── Attendance table ── */
.att-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
    align-items: start;
}

.att-table-wrap {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.att-table-wrap::-webkit-scrollbar {
    height: 6px;
}

.att-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.att-table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.att-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(0, 0, 0, .4);
}

th {
    padding: 1rem 1.2rem;
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: .55;
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: .9rem 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, .05);
    font-size: .88rem;
    vertical-align: top;
}

tbody tr {
    transition: .2s;
    cursor: pointer;
}

tbody tr:hover {
    background: rgba(255, 255, 255, .03);
}

tbody tr.expanded {
    background: rgba(79, 172, 254, .05);
}

/* ── Badges ── */
.badge {
    padding: .28rem .75rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .5px;
}

.badge-in {
    background: rgba(0, 255, 163, .12);
    color: var(--success);
}

.badge-out {
    background: rgba(79, 172, 254, .12);
    color: var(--secondary);
}

.badge-offline {
    background: rgba(255, 0, 124, .12);
    color: var(--accent);
}

.badge-present {
    background: rgba(0, 255, 163, .1);
    color: var(--success);
}

.badge-incomplete {
    background: rgba(255, 179, 0, .1);
    color: var(--warn);
}

/* ── Expand row (punch timeline) ── */
.expand-row {
    display: none;
}

.expand-row.active {
    display: table-row;
}

.expand-cell {
    padding: 0 !important;
}

.punch-timeline {
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, .3);
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    align-items: center;
}

.punch-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
}

.punch-time {
    font-size: .8rem;
    font-weight: 600;
}

.punch-dir {
    font-size: .65rem;
    opacity: .6;
}

.timeline-arrow {
    opacity: .3;
    font-size: .9rem;
}

/* ── Empty/loading states ── */
.empty-att {
    text-align: center;
    padding: 3rem;
    opacity: .35;
}

.empty-att .icon {
    font-size: 3rem;
    margin-bottom: .8rem;
}

.loading-row td {
    text-align: center;
    padding: 2.5rem;
    opacity: .4;
}

/* ── Live feed sidebar ── */
.live-feed-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
}

.feed-scroll {
    max-height: 520px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.feed-scroll::-webkit-scrollbar {
    width: 4px;
}

.feed-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.feed-item {
    background: rgba(0, 0, 0, .25);
    border-radius: 10px;
    padding: .8rem 1rem;
    border-left: 3px solid var(--primary);
    animation: slideIn .3s ease-out;
}

.feed-item.offline-item {
    border-left-color: var(--accent);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.feed-name {
    font-size: .88rem;
    font-weight: 600;
}

.feed-meta {
    font-size: .72rem;
    opacity: .5;
    margin-top: .15rem;
}

/* ── Enrollment layout ── */
.enroll-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.control-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.8rem;
}

.form-row {
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
    margin-top: .8rem;
}

.form-group {
    flex: 1;
}

/* ── Mode toggle ── */
.mode-toggle {
    display: flex;
    background: rgba(0, 0, 0, .35);
    border-radius: 12px;
    padding: .4rem;
    gap: .4rem;
}

.mode-toggle button {
    flex: 1;
    padding: .6rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, .55);
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    transition: .25s;
}

.mode-toggle button.active {
    background: var(--secondary);
    color: var(--bg);
}

/* ── User table ── */
.user-table-wrap {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    -webkit-overflow-scrolling: touch;
}

.user-table-wrap::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.user-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.user-table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.user-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

.user-table-wrap table td:last-child {
    text-align: right;
}

/* ── CSV Export card ── */
.export-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.8rem;
    margin-top: 2rem;
}

.export-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.2rem;
    align-items: flex-end;
}

.export-filter-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 160px;
}

.export-btns {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin-top: 1.2rem;
}

.export-btn {
    padding: .7rem 1.3rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 242, 254, .2);
    font-weight: 600;
    cursor: pointer;
    font-size: .83rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: rgba(0, 242, 254, .08);
    color: var(--primary);
    transition: .25s;
}

.export-btn:hover {
    background: rgba(0, 242, 254, .16);
    transform: translateY(-1px);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .att-layout {
        grid-template-columns: 1fr;
    }

    .enroll-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .metrics-bar {
        grid-template-columns: repeat(3, 1fr);
    }

    .att-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .metrics-bar {
        grid-template-columns: 1fr 1fr;
    }
}