/* PU-29 Premium Styling */

/* ===== PU-29 TOOLTIP SYSTEM ===== */
.pu29-tooltip-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99998;
    background: transparent;
}

.pu29-norm-tooltip {
    position: fixed;
    z-index: 99999;
    min-width: 280px;
    max-width: 380px;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    border: 1.5px solid rgba(251, 191, 36, 0.35);
    border-radius: 16px;
    padding: 0;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(251, 191, 36, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-family: 'Inter', sans-serif;
    color: #e2e8f0;
    pointer-events: auto;
    animation: pu29TooltipIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

@keyframes pu29TooltipIn {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.pu29-norm-tooltip .tt-header {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.05) 100%);
    padding: 14px 18px 12px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.pu29-norm-tooltip .tt-header .tt-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.pu29-norm-tooltip .tt-header .tt-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fbbf24;
    line-height: 1.2;
}

.pu29-norm-tooltip .tt-header .tt-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
    font-weight: 500;
}

.pu29-norm-tooltip .tt-body {
    padding: 14px 18px 16px;
}

.pu29-norm-tooltip .tt-full-name {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    line-height: 1.4;
    font-weight: 500;
}

.pu29-norm-tooltip .tt-norms {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pu29-norm-tooltip .tt-norm-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.pu29-norm-tooltip .tt-norm-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.pu29-norm-tooltip .tt-norm-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}

.pu29-norm-tooltip .tt-norm-dot.green { background: #22c55e; color: #22c55e; }
.pu29-norm-tooltip .tt-norm-dot.yellow { background: #eab308; color: #eab308; }
.pu29-norm-tooltip .tt-norm-dot.red { background: #ef4444; color: #ef4444; }

.pu29-norm-tooltip .tt-norm-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    flex-shrink: 0;
    min-width: 55px;
    font-weight: 600;
}

.pu29-norm-tooltip .tt-norm-value {
    font-size: 0.82rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-left: auto;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.pu29-norm-tooltip .tt-note {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 8px;
    font-size: 0.7rem;
    color: rgba(147, 197, 253, 0.9);
    line-height: 1.4;
}

.pu29-norm-tooltip .tt-note i {
    margin-right: 5px;
    color: #60a5fa;
}


.h-p29[data-norm-id] {
    cursor: pointer;
    transition: all 0.2s ease;
}

.h-p29[data-norm-id]:hover {
    background: #dbeafe !important;
    box-shadow: inset 0 -3px 0 #3b82f6;
}

/* Mobile tooltip adjustments */
@media (max-width: 768px) {
    .pu29-norm-tooltip {
        min-width: 250px;
        max-width: 320px;
        font-size: 0.85rem;
    }
}

.pu29-doc-w {
    background: #ffffff;
    padding: 40px;
    box-shadow: 0 10px 45px rgba(0,0,0,0.15);
    font-family: "Times New Roman", serif;
    color: #1a1a1a;
    min-width: 1950px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 0 auto;
}

.hdr-inp {
    border: none;
    border-bottom: 1.5px solid #cbd5e1;
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
    font-weight: 700;
    background: transparent;
    color: #1e293b;
    transition: border-color 0.2s;
}

.hdr-inp:focus {
    outline: none;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.pu29-dt {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #0f172a;
    margin-top: 25px;
}

.pu29-dt th {
    border: 1px solid #0f172a;
    padding: 8px 4px;
    text-align: center;
    vertical-align: middle;
    font-size: 0.65rem;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 800;
    line-height: 1.3;
}

.pu29-dt td {
    border: 1px solid #475569;
    padding: 4px;
    text-align: center;
    vertical-align: middle;
    font-size: 0.85rem;
    height: 24px;
}

.pu29-dt .data-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.v-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: 0 auto;
    white-space: nowrap;
    max-height: 200px;
    pointer-events: none;  /* Click TH orqali o'tadi */
    display: block;
}

.pu29-dt thead th {
    cursor: pointer;
    overflow: visible;
    position: relative;
}

.pu29-dt thead th:hover {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border-bottom: 3px solid #3b82f6 !important;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
}

.pu29-dt thead th::after {
    content: '';
    position: absolute;
    inset: 0;
    cursor: pointer;
    z-index: 10;
}

.static-val {
    font-size: 0.7rem;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
    width: 35px;
}

.u-val {
    color: #2563eb;
    background: #eff6ff;
}

.hdr-top {
    font-weight: 900;
    font-size: 0.75rem;
    background: #e2e8f0 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile Responsiveness for PU-29 */
@media (max-width: 768px) {
    .integration-window {
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        top: 0 !important;
        transform: none !important;
        border-radius: 0 !important;
    }

    .pu29-form-w {
        flex-direction: column !important;
    }

    .pu29-sidebar {
        width: 100% !important;
        height: auto !important;
        max-height: 180px !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        padding-bottom: 10px !important;
    }

    .pu29-sidebar-hdr {
        display: none !important;
    }

    .pu29-sidebar-footer {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        padding: 10px 15px !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 100 !important;
        background: #1e293b !important;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.3) !important;
    }

    .pu29-sidebar-footer button {
        flex: 1 !important;
        margin: 0 !important;
    }

    /* Content area adjustment to not hide behind the bottom bar */
    .pu29-content-scroll {
        padding: 15px 15px 80px 15px !important;
    }


    .pu29-tab-btn {
        flex-direction: column !important;
        min-width: 100px !important;
        text-align: center !important;
        padding: 10px 5px !important;
    }

    .pu29-tab-btn i {
        margin: 0 !important;
        font-size: 1.2rem !important;
    }

    .pu29-tab-btn .tab-desc {
        display: none !important;
    }

    .pu29-content-scroll {
        padding: 15px !important;
    }

    .f-card > div {
        grid-template-columns: 1fr !important; /* Force 1 column on mobile */
    }

    /* Table horizontal scroll */
    .mega-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .pu29-mega-table {
        min-width: 1200px; /* Ensure table keeps its structure but scrolls */
    }
}

/* Modal Form Styles Overlay */
#pu29-entry-modal .window-content {
    background: #0f172a !important;
}

.pu29-form-section { 
    display: none; 
    opacity: 0; 
    transform: translateY(10px); 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}
.pu29-form-section.active { 
    display: block; 
    opacity: 1;
    transform: translateY(0);
}

.f-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 30px rgba(0,0,0,0.08); 
    border-color: #3b82f6; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism for sidebar buttons */
.pu29-tab-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pu29-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.02);
}

.f-input {
    transition: all 0.2s;
}

.f-input:focus {
    transform: translateY(-1px);
}

/* Premium Metadata Grid */
.pu29-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 25px 0 35px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.pu29-meta-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease-in-out;
}

.pu29-meta-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.pu29-meta-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
}

/* Custom styled dropdowns and inputs inside PU-29 */
select.pu29-select {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    color: #1e293b !important;
    padding: 8px 36px 8px 12px !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    font-family: 'Inter', sans-serif !important;
    transition: all 0.2s ease-in-out !important;
    cursor: pointer !important;
    width: 100% !important;
    outline: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
}

select.pu29-select:hover {
    border-color: #3b82f6 !important;
    background-color: #f8fafc !important;
}

select.pu29-select:focus {
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* Editable values */
input[type="text"].pu29-input {
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #1e293b !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    outline: none !important;
    transition: all 0.2s ease-in-out !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

input[type="text"].pu29-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* Static values */
.pu29-static-val {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    padding: 8px 12px !important;
    background: #f1f5f9 !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    height: 38px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Header Dropdown */
select.pu29-header-select {
    background: #0f172a !important;
    color: #fbbf24 !important;
    border: 1.5px solid rgba(251, 191, 36, 0.4) !important;
    padding: 8px 36px 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 800 !important;
    font-size: 1.1rem !important;
    cursor: pointer !important;
    outline: none !important;
    margin-left: 10px !important;
    transition: all 0.2s ease-in-out !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23fbbf24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
}

select.pu29-header-select:hover {
    border-color: #fbbf24 !important;
    background-color: #1e293b !important;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2) !important;
}

@media (max-width: 1024px) {
    .pu29-meta-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .pu29-meta-grid {
        grid-template-columns: 1fr !important;
    }
}
