/* ============================================================
   pplgreen.css — shared styles extracted from Razor pages
   ============================================================ */

/* ----------------------------------------------------------
   NavMenu — user panel & status badge
   ---------------------------------------------------------- */
.ksef-status-badge {
    font-size: 0.75rem;
    padding: 0.4em 0.8em;
    transition: all 0.3s ease;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.user-menu { position: relative; }
.user-icon-btn {
    background: none; border: none; padding: 0; cursor: pointer; line-height: 1;
    color: #2D8C6F; font-size: 1.6rem;
    display: inline-flex; align-items: center; gap: 2px;
}
.user-icon-btn:hover { color: #1f6b54; }

.user-panel {
    display: none;
    position: absolute; right: 0; top: 100%; margin-top: 6px;
    width: 340px; max-width: 90vw;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,.15);
    z-index: 1200; overflow: hidden;
}
.user-panel.show { display: block; }

.user-panel-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; background: #f0fdf4; border-bottom: 1px solid #e2e8f0;
    color: #2D8C6F;
}
.user-panel-header i { font-size: 1.5rem; }
.user-panel-name { font-weight: 600; }

.user-panel-body { padding: 12px 16px; }
.up-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; }
.up-label { color: #64748b; }
.up-val { font-weight: 500; color: #2D3748; text-align: right; word-break: break-word; }

.up-claims-title { margin-top: 12px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: #475569; }
.up-claims { max-height: 220px; overflow-y: auto; border: 1px solid #f1f5f9; border-radius: 6px; }
.up-claim {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 5px 8px; font-size: 12px; border-bottom: 1px solid #f8fafc;
}
.up-claim:last-child { border-bottom: none; }
.up-claim-type { color: #3730a3; font-family: monospace; white-space: nowrap; }
.up-claim-val { color: #334155; text-align: right; word-break: break-word; }

.user-panel-footer { padding: 10px 16px; border-top: 1px solid #e2e8f0; background: #f9fafb; }
.up-logout {
    display: inline-flex; align-items: center; gap: 6px;
    color: #b91c1c; text-decoration: none; font-weight: 500;
}
.up-logout:hover { text-decoration: underline; color: #991b1b; }

/* ----------------------------------------------------------
   Shared — section header, permission header
   ---------------------------------------------------------- */
.section-header { display: flex; align-items: center; margin-bottom: 15px; }

.perm-header { display:flex; align-items:center; gap:10px; color:#2D8C6F; font-weight:600; margin-bottom:20px; }

/* ----------------------------------------------------------
   Identity — Users page
   ---------------------------------------------------------- */
.modern-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: #2D8C6F;
    font-weight: 600;
}

.modern-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.modern-form-field {
    margin-bottom: 16px;
}

.modern-form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2D3748;
    font-size: 14px;
}

.nip-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.nip-input {
    width: 100%;
    height: 42px;
    padding: 0 45px 0 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.nip-input:focus {
    outline: none;
    border-color: #2D8C6F;
    box-shadow: 0 0 0 3px rgba(45, 140, 111, 0.1);
}

.add-nip-btn {
    position: absolute;
    right: 6px;
    background: #2D8C6F;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    cursor: pointer;
}

.nip-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 6px 6px;
    z-index: 1100;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    max-height: 160px;
    overflow-y: auto;
}

.nip-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f7fafc;
    font-family: monospace;
    font-size: 13px;
}

.nip-option:hover {
    background: #f0fdf4;
    color: #2D8C6F;
}

.selected-nips-box {
    margin-top: 12px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #cbd5e0;
}

.nip-chip {
    display: inline-flex;
    align-items: center;
    background-color: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
}

.nip-badge {
    background-color: #f8f9fa;
    color: #5f6368;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Roboto Mono', monospace;
    border: 1px solid #e8eaed;
}

.nip-count {
    font-size: 11px;
    color: #4aa885;
    font-weight: 500;
    padding-left: 3px;
    cursor: default;
}

.group-badge {
    background-color: #e8f5ee;
    color: #2f7d5b;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #cde9da;
}

.group-empty {
    font-size: 13px;
    color: #9aa0a6;
    font-style: italic;
}

.remove-chip {
    background: none;
    border: none;
    color: #2D3748;
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    padding: 0;
}

.modern-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
}

/* ----------------------------------------------------------
   Permissions — ControlGrants
   ---------------------------------------------------------- */
.badge-editable { background:#d1e7dd; color:#0a3622; border-radius:12px; padding:3px 10px; font-size:12px; font-weight:500; }
.badge-readonly { background:#fff3cd; color:#664d03; border-radius:12px; padding:3px 10px; font-size:12px; font-weight:500; }
.condition-chip { background:#e0e7ff; color:#3730a3; border-radius:10px; padding:2px 8px; font-size:11px; font-family:monospace; }
.filters-bar { background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; padding:14px 18px; margin-bottom:16px; }
.grant-form-panel { background:#fff; border:1px solid #cbd5e0; border-radius:10px; padding:20px; margin-bottom:20px; }
.grant-form-title { font-size:15px; font-weight:600; color:#2D8C6F; margin-bottom:16px; display:flex; align-items:center; gap:8px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:14px; }
.form-field label { display:block; font-size:13px; font-weight:600; color:#374151; margin-bottom:5px; }

/* ----------------------------------------------------------
   Permissions — PermissionGroups
   ---------------------------------------------------------- */
.perm-card { background:#fff; border:1px solid #e2e8f0; border-radius:10px; padding:20px; height:100%; }
.perm-badge-member { background:#e6f4f0; color:#2D8C6F; border-radius:12px; padding:2px 10px; font-size:12px; font-weight:500; }
.section-title { font-size:14px; font-weight:600; color:#4a5568; margin-bottom:12px; display:flex; align-items:center; gap:8px; }
.inline-form-box { background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; padding:16px; margin-bottom:14px; }

/* ----------------------------------------------------------
   Permissions — ProtectedControls
   ---------------------------------------------------------- */
.badge-registered { background:#fff3cd; color:#856404; border-radius:12px; padding:3px 10px; font-size:12px; font-weight:500; }
.badge-revealed { background:#d1e7dd; color:#0a3622; border-radius:12px; padding:3px 10px; font-size:12px; font-weight:500; }
.info-box { background:#f0fdf4; border:1px solid #bbf7d0; border-radius:8px; padding:12px 16px; margin-bottom:20px; font-size:13px; color:#166534; }
.register-form { background:#fff; border:1px solid #cbd5e0; border-radius:10px; padding:20px; margin-bottom:20px; }
.register-form-title { font-size:15px; font-weight:600; color:#2D8C6F; margin-bottom:14px; display:flex; align-items:center; gap:8px; }
.ctrl-code-display { font-family:monospace; font-size:13px; color:#2D3748; }

/* ----------------------------------------------------------
   Permissions — PermissionsAudit
   ---------------------------------------------------------- */
.audit-cards { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:22px; }
.audit-card { background:#fff; border:1px solid #e2e8f0; border-radius:10px; padding:14px 18px; min-width:150px; }
.audit-card .n { font-size:26px; font-weight:700; line-height:1; }
.audit-card .l { font-size:12px; color:#64748b; margin-top:6px; }
.audit-card.warn { border-color:#fca5a5; background:#fef2f2; }
.audit-card.warn .n { color:#b91c1c; }
.audit-card.info { border-color:#fcd34d; background:#fffbeb; }
.badge-api { background:#fee2e2; color:#991b1b; border-radius:10px; padding:2px 8px; font-size:11px; font-weight:600; }
.badge-fe { background:#e0e7ff; color:#3730a3; border-radius:10px; padding:2px 8px; font-size:11px; }
.badge-rev { background:#d1e7dd; color:#0a3622; border-radius:10px; padding:2px 8px; font-size:11px; }
.badge-reg { background:#fff3cd; color:#856404; border-radius:10px; padding:2px 8px; font-size:11px; }
code.cc { font-size:13px; color:#2D3748; }

/* ----------------------------------------------------------
   KSeF — action bar & buttons (KsefUser / KsefUserAdmin)
   ---------------------------------------------------------- */
.ksef-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.ksef-action-button {
    min-height: 38px;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.ksef-action-button.primary {
    background-color: var(--paperlink-green, #4aa885);
    color: white;
    border-color: var(--paperlink-green, #4aa885);
}

.ksef-action-button.primary:hover:not(:disabled) {
    background-color: var(--paperlink-green-hover, #3d8f6f);
    border-color: var(--paperlink-green-hover, #3d8f6f);
}

.ksef-action-button.secondary {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.ksef-action-button.secondary:hover:not(:disabled) {
    background-color: #5a6268;
    border-color: #545b62;
}

.ksef-action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9ecef !important;
    color: #6c757d !important;
    border-color: #dee2e6 !important;
}

.ksef-action-button:disabled .rz-button-icon {
    opacity: 0.6;
}

/* ----------------------------------------------------------
   KSeF — AddKsefUserDialog form
   ---------------------------------------------------------- */
.ksef-form-container {
    min-width: 500px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ksef-form-description {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--paperlink-green);
}

.ksef-form-description p {
    margin: 0;
    color: #495057;
    font-size: 0.95rem;
    line-height: 1.4;
}

.ksef-form-group {
    margin-bottom: 1.25rem;
}

.ksef-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.ksef-form-label.required::after {
    content: ' *';
    color: #dc3545;
    font-weight: 600;
}

.ksef-input-field {
    width: 100%;
    min-height: 42px;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.925rem;
    transition: all 0.15s ease;
    background-color: white;
    color: #374151;
}

.ksef-input-field:focus {
    outline: none;
    border-color: var(--paperlink-green);
    box-shadow: 0 0 0 3px rgba(74, 168, 133, 0.1);
}

.ksef-file-input-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.ksef-file-input {
    width: 100%;
    min-height: 42px;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.925rem;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ksef-file-input:hover {
    border-color: var(--paperlink-green);
    background-color: #f8f9fa;
}

.ksef-file-input:focus {
    outline: none;
    border-color: var(--paperlink-green);
    box-shadow: 0 0 0 3px rgba(74, 168, 133, 0.1);
}

.ksef-file-input::file-selector-button {
    background-color: var(--paperlink-green);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 3px;
    font-size: 0.825rem;
    font-weight: 500;
    margin-right: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ksef-file-input::file-selector-button:hover {
    background-color: var(--paperlink-green-hover);
}

.ksef-checkbox-section {
    display: none;
}

.ksef-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: right;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ----------------------------------------------------------
   Document — KsefDownloadDialog
   ---------------------------------------------------------- */
.download-dialog .dialog-content {
    padding: 20px;
}

.download-dialog .dialog-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    color: #333;
}

.download-dialog .dialog-body {
    margin-bottom: 20px;
}

.download-dialog .date-selection {
    margin-bottom: 15px;
}

.download-dialog .info-section {
    border: 1px solid #b3d9ff;
}

.download-dialog .dialog-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

/* ----------------------------------------------------------
   Home page
   ---------------------------------------------------------- */
.homepage-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.homepage-header {
    display: flex;
    align-items: flex-start;
    gap: 3rem;
    margin-bottom: 4rem;
}

.homepage-logo {
    flex-shrink: 0;
}

.homepage-logo img {
    width: 180px;
    height: auto;
}

.homepage-title {
    flex-grow: 1;
}

.homepage-title h1 {
    color: var(--text-dark);
    font-size: 2.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.homepage-subtitle {
    color: var(--text-gray);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
    margin: 0;
}

.homepage-section {
    margin-bottom: 3rem;
}

.homepage-section h2 {
    color: var(--text-dark);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.feature-item {
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.feature-item h3 {
    color: #333;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.feature-item p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.compliance-note {
    color: #666;
    font-size: 1rem;
    font-style: italic;
    text-align: center;
    margin: 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.instruction-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #0c4a6e;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-top: 1rem;
}

.instruction-link:hover {
    background-color: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.instruction-link i {
    font-size: 1.2em;
    color: #0284c7;
}

.pdf-icon {
    font-size: 1.2em;
    display: inline-block;
}

@media (max-width: 768px) {
    .homepage-header {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .homepage-logo img {
        width: 150px;
    }

    .homepage-title h1 {
        font-size: 2.25rem;
    }

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

/* ----------------------------------------------------------
   KSeF — KsefUser auth dialog (inline render fragment)
   ---------------------------------------------------------- */
.ksef-auth-modal {
    min-width: 550px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ksef-auth-description {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--paperlink-green);
}

.ksef-auth-description p {
    margin: 0;
    color: #495057;
    font-size: 0.95rem;
    line-height: 1.4;
}

.ksef-auth-form-group {
    margin-bottom: 1.25rem;
}

.ksef-auth-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.ksef-auth-form-label.required::after {
    content: ' *';
    color: #dc3545;
    font-weight: 600;
}

.ksef-auth-input-field {
    width: 100%;
    min-height: 42px;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.925rem;
    transition: all 0.15s ease;
    background-color: white;
    color: #374151;
}

.ksef-auth-input-field:focus {
    outline: none;
    border-color: var(--paperlink-green);
    box-shadow: 0 0 0 3px rgba(74, 168, 133, 0.1);
}

.ksef-auth-file-input {
    width: 100%;
    min-height: 42px;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.925rem;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ksef-auth-file-input:hover {
    border-color: var(--paperlink-green);
    background-color: #f8f9fa;
}

.ksef-auth-file-input:focus {
    outline: none;
    border-color: var(--paperlink-green);
    box-shadow: 0 0 0 3px rgba(74, 168, 133, 0.1);
}

.ksef-auth-file-input::file-selector-button {
    background-color: var(--paperlink-green);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 3px;
    font-size: 0.825rem;
    font-weight: 500;
    margin-right: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ksef-auth-file-input::file-selector-button:hover {
    background-color: var(--paperlink-green-hover);
}

.ksef-auth-checkbox-section {
    display: none;
}

.ksef-auth-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: right;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
