/* certificates.css - Premium Dashboard Layout */

/* --- MAIN LAYOUT --- */
.certificates-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}

.certificates-main-column, .certificates-widgets {
    min-width: 0; /* Prevents CSS grid blowout */
}

/* --- TABS --- */
.cert-tabs-container {
    border-bottom: 2px solid var(--fellow-line);
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
}

.cert-tabs-container::-webkit-scrollbar {
    display: none;
}

.cert-tabs {
    display: flex;
    gap: 32px;
    white-space: nowrap;
}

.cert-tabs button {
    background: transparent;
    border: 0;
    padding: 0 0 16px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fellow-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.cert-tabs button:hover {
    color: var(--fellow-text);
}

.cert-tabs button.active {
    color: var(--fellow-pink);
}

.cert-tabs button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--fellow-pink);
    border-radius: 2px 2px 0 0;
}

/* --- STATS GRID --- */
.cert-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.c-stat-card {
    background: #fff;
    border: 1px solid var(--fellow-line);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(170, 52, 104, 0.02);
}

.c-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.c-icon.pink { background: #fdf2f8; color: #db2777; }
.c-icon.green { background: #f0fdf4; color: #16a34a; }
.c-icon.orange { background: #fff7ed; color: #ea580c; }
.c-icon.purple { background: #faf5ff; color: #9333ea; }

.c-info {
    display: flex;
    flex-direction: column;
}

.c-info span {
    font-size: 0.75rem;
    color: var(--fellow-muted);
    margin-bottom: 4px;
    line-height: 1.2;
}

.c-info strong {
    font-size: 1.4rem;
    color: var(--fellow-text);
    line-height: 1.1;
    margin-bottom: 2px;
}

.c-info small {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* --- CONTROLS --- */
.cert-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.cert-controls .cert-sort {
    width: 160px;
    margin-bottom: 0;
}

.cert-controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cert-inline-search {
    position: relative;
    width: 240px;
    margin-bottom: 0;
}

.btn-grid-toggle {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--fellow-line);
    color: var(--fellow-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-grid-toggle.active {
    background: #fdf2f8;
    color: var(--fellow-pink);
    border-color: #fbcfe8;
}

/* --- CERTIFICATE GRID --- */
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.cert-card {
    background: #fff;
    border: 1px solid var(--fellow-line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(170, 52, 104, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.cert-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(170, 52, 104, 0.08);
}

/* CSS Certificate Thumbnail */
.cert-thumb {
    position: relative;
    padding: 32px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.cert-thumb::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px dashed rgba(0,0,0,0.1);
    border-radius: 12px;
    pointer-events: none;
}

.cert-badge {
    position: absolute;
    top: 0;
    right: 24px;
    width: 32px;
    height: 42px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cert-badge::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 8px solid;
}

.cert-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex-grow: 1;
    justify-content: center;
}

.cert-head {
    margin: 0 0 12px;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.cert-sub {
    font-size: 0.5rem;
    color: #64748b;
    margin: 0 0 6px;
    letter-spacing: 1px;
}

.cert-name {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: #0f172a;
    font-family: 'Georgia', serif;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 4px;
    width: 80%;
}

.cert-desc {
    font-size: 0.5rem;
    color: #64748b;
    margin: 0 0 4px;
}

.cert-course {
    margin: 0;
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.2;
}

.cert-seal {
    margin-top: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cert-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    z-index: 2;
    padding: 0 8px;
}

.cert-sig {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.2);
    padding-top: 4px;
    min-width: 60px;
}

.sig-herai {
    font-family: 'Brush Script MT', cursive, serif;
    font-size: 0.8rem;
    color: #db2777;
}

.sig-script {
    font-size: 0.5rem;
    color: #64748b;
}

/* Themes */
.pink-theme { background: linear-gradient(135deg, #fff1f2, #fce7f3); }
.cert-badge.pink { background: #db2777; }
.cert-badge.pink::after { border-top-color: #db2777; }
.cert-head.pink { color: #be185d; }
.cert-seal.pink { background: #db2777; color: #fff; }

.purple-theme { background: linear-gradient(135deg, #f5f3ff, #f3e8ff); }
.cert-badge.purple { background: #9333ea; }
.cert-badge.purple::after { border-top-color: #9333ea; }
.cert-seal.purple { background: #9333ea; color: #fff; }

.orange-theme { background: linear-gradient(135deg, #fff7ed, #ffedd5); }
.cert-badge.orange { background: #ea580c; }
.cert-badge.orange::after { border-top-color: #ea580c; }
.cert-seal.orange { background: #ea580c; color: #fff; }

.green-theme { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.cert-badge.green { background: #16a34a; }
.cert-badge.green::after { border-top-color: #16a34a; }
.cert-seal.green { background: #16a34a; color: #fff; }

.blue-theme { background: linear-gradient(135deg, #eff6ff, #dbeafe); }
.cert-badge.blue { background: #2563eb; }
.cert-badge.blue::after { border-top-color: #2563eb; }
.cert-seal.blue { background: #2563eb; color: #fff; }

.red-theme { background: linear-gradient(135deg, #fef2f2, #fee2e2); }
.cert-badge.red { background: #dc2626; }
.cert-badge.red::after { border-top-color: #dc2626; }
.cert-seal.red { background: #dc2626; color: #fff; }

.cert-head { background: linear-gradient(90deg, #9333ea, #db2777); -webkit-background-clip: text; color: transparent; }

/* Cert Card Details */
.cert-details {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cert-details h4 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: var(--fellow-text);
    line-height: 1.3;
}

.cert-details p {
    font-size: 0.75rem;
    color: var(--fellow-muted);
    margin: 0 0 16px;
}

.cert-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    font-size: 0.8rem;
}

.cert-meta span {
    color: var(--fellow-muted);
}

.cert-meta strong {
    font-size: 0.85rem;
}

.pink-text { color: #db2777; }
.purple-text { color: #9333ea; }
.orange-text { color: #ea580c; }
.green-text { color: #16a34a; }
.blue-text { color: #2563eb; }
.red-text { color: #dc2626; }


/* --- WIDGETS --- */
.certificates-widgets {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget-card {
    background: #fff;
    border: 1px solid var(--fellow-line);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(170, 52, 104, 0.03);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}

.widget-header.border-bottom {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--fellow-line);
}

.widget-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--fellow-text);
}

.reset-link {
    font-size: 0.75rem;
    color: var(--fellow-pink);
    text-decoration: none;
}

/* Donut Chart */
.chart-container-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.donut-chart-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

.donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-hole { fill: #fff; }
.donut-ring { fill: transparent; stroke: #f1f5f9; stroke-width: 16; }

.donut-segment {
    fill: transparent;
    stroke-width: 16;
}

.pink-stroke { stroke: #db2777; }
.purple-stroke { stroke: #9333ea; }
.orange-stroke { stroke: #ea580c; }
.green-stroke { stroke: #16a34a; }

.donut-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.donut-text strong { font-size: 1.4rem; color: var(--fellow-text); line-height: 1; }
.donut-text span { font-size: 0.7rem; color: var(--fellow-muted); margin-top: 2px; }

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
}

.legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.pink-dot { background: #db2777; }
.purple-dot { background: #9333ea; }
.orange-dot { background: #ea580c; }
.green-dot { background: #16a34a; }

.legend-item span:nth-child(2) {
    color: var(--fellow-muted);
    flex-grow: 1;
}

.legend-item strong {
    color: var(--fellow-text);
}

/* Filter Dropdowns */
.filter-dropdowns {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-dropdowns .custom-select {
    margin-bottom: 0;
}

/* Status List */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.status-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fellow-muted);
}

.status-label i { font-size: 1.1rem; }
.status-item strong { color: var(--fellow-text); }
.text-muted { color: #94a3b8; }

/* Help Banner */
.help-banner {
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pink-gradient-bg {
    background: linear-gradient(135deg, #fbcfe8, #f43f5e);
}

.help-content {
    position: relative;
    z-index: 2;
    max-width: 65%;
}

.help-content h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.help-content p {
    margin: 0 0 16px;
    font-size: 0.75rem;
    opacity: 0.9;
    line-height: 1.4;
}

.help-content .btn-primary-pink {
    background: #fff;
    color: #e11d48;
    font-size: 0.8rem;
    padding: 8px 16px;
}

.bot-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 6rem;
    color: rgba(255,255,255,0.2);
    z-index: 1;
    transform: rotate(-15deg);
}

/* --- RESPONSIVE --- */
@media (max-width: 1400px) {
    .certificates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .cert-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1080px) {
    .certificates-layout {
        grid-template-columns: 1fr;
    }

    .certificates-widgets {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .cert-stats-grid {
        grid-template-columns: 1fr;
    }

    .cert-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .cert-controls .cert-sort {
        width: 100%;
    }

    .cert-controls-right {
        width: 100%;
    }

    .cert-inline-search {
        width: 100%;
        flex-grow: 1;
    }

    .certificates-grid {
        grid-template-columns: 1fr;
    }

    .help-content {
        max-width: 100%;
    }
}
