/**
 * Copyright (C) 2025  Sandip Ghimire
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/gpl-3.0.en.html>.
 */

.udp-portal {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0 auto;
    padding: 28px 16px;
    color: #1e293b;
}

.udp-portal:has(.udp-doc-card) {
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding-block: 15px;
}

.udp-portal h3, .udp-portal h1, .udp-portal h2{
    margin: 0px !important;
}

/* ----- Preview banner ----- */
.udp-preview-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 11px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
}

.udp-preview-exit {
    color: #92400e;
    font-weight: 600;
    text-decoration: underline;
}

/* ----- Login card ----- */
.udp-login-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 36px 32px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    max-width: 470px;
    margin: 0px auto;
}

.udp-login-card h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 600;
    color: #0f172a;
}

.udp-login-card > p {
    color: #64748b;
    margin: 0 0 24px;
    font-size: 14px;
}

.udp-form-group {
    margin-bottom: 14px;
}

.udp-form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #374151;
    font-size: 13px;
}

.udp-form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
    color: #0f172a !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.udp-form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* ----- Error ----- */
.udp-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 9px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

/* ----- Buttons ----- */
.udp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    background: #fff;
    color: #374151;
    white-space: nowrap;
}

.udp-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

.udp-btn--primary {
    background: #2563eb;
    color: #fff;
    width: 100%;
    border-color: #2563eb;
    font-size: 14px;
    padding: 10px;
    margin-top: 4px;
}

.udp-btn--primary:hover {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

.udp-btn--logout {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff;
}

.udp-btn--logout:hover {
    background: #fef2f2;
}

.udp-btn--download {
    background: #1e293b;
    color: #fff;
    border-color: #1e293b;
    width: 100%;
    justify-content: center;
    margin-top: auto;
    padding: 9px 14px;
}

.udp-btn--download:hover {
    background: #0f172a;
    color: #fff;
}

.udp-btn--sm {
    padding: 6px 12px;
    font-size: 12px;
}

.udp-btn--outline {
    background: transparent;
    color: #64748b;
    border-color: #e2e8f0;
}

.udp-btn--outline:hover {
    background: #f8fafc;
    color: #334155;
}

/* ----- Dashboard header ----- */
.udp-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-inline: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 16px;
}

.udp-dashboard-header h2 {
    margin-bottom: -10px !important;
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
}

.udp-client-label {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.udp-client-label strong {
    color: #3b82f6;
    font-weight: 600;
}

.udp-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ----- Session badge ----- */
.udp-session-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}

.udp-session-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

/* ----- Year selector row ----- */
.udp-year-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #64748b;
}

.udp-year-row select {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
}

/* ----- States ----- */
.udp-loading,
.udp-empty {
    text-align: center;
    padding: 48px;
    color: #94a3b8;
    font-size: 14px;
}

/* ----- Document card grid ----- */
.udp-doc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.udp-doc-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 22px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.udp-doc-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.udp-doc-card__icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.udp-doc-card h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.udp-doc-card-header-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.udp-doc-card p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    flex: 1;
}

/* Year card select */
.udp-doc-card select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    margin-top: auto;
}

/* Icon colour variants */
.udp-icon--blue   { background: #eff6ff; }
.udp-icon--green  { background: #f0fdf4; }
.udp-icon--amber  { background: #fffbeb; }
.udp-icon--purple { background: #f5f3ff; }
.udp-icon--red    { background: #fef2f2; }

/* ----- Responsive ----- */
@media (max-width: 600px) {
    .udp-dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .udp-doc-cards {
        grid-template-columns: 1fr;
    }
}

.udp-turnstile-wrap {
    margin: 16px 0 4px;
    display: flex;
    justify-content: flex-start;
}

.udp-turnstile-wrap .cf-turnstile iframe {
    max-width: 100%;
}