/**
 * SwissFileChecker - Zentrales Portal-Design
 * Gemeinsames Stylesheet für Admin-Panel und Customer-Portal
 * Version: 1.2 (02.01.2026) - FULLY SCOPED to .portal-body
 */

:root {
    --primary-color: #0066cc;
    --secondary-color: #667eea;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
    --card-hover-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* ========================================
   BASIS-STYLES (SCOPED)
   ======================================== */
.portal-body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* GLOBAL BOX SIZING FIX */
.portal-body *, .portal-body *::before, .portal-body *::after {
    box-sizing: border-box;
}

/* Navigation scoped */
.portal-body .nav-portal {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004999 100%) !important;
    color: white !important;
    padding: 0;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ... (Header styles omitted for brevity) ... */

/* Form elements scoped to portal-body */
.portal-body input[type="text"],
.portal-body input[type="email"],
.portal-body input[type="password"],
.portal-body input[type="number"],
.portal-body input[type="date"],
.portal-body select,
.portal-body textarea,
.portal-body .input-full {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    min-height: 44px;
    transition: all 0.3s ease;
    width: 100%;
    font-family: inherit;
    box-sizing: border-box !important; /* Force correct sizing */
    background: white;
}

.portal-body .readonly-field {
    background-color: #e9ecef !important;
    cursor: default;
    color: #495057;
    border-color: #ced4da;
}

.portal-body .required:after {
    content: " *";
    color: #e53e3e;
}

.portal-body input:focus,
.portal-body select:focus,
.portal-body textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    outline: none;
}

/* Grid system (Responsive) */
.portal-body .grid-2 { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 20px; 
}

.portal-body .grid-3 { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px; 
}

.portal-body .grid-4 { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; 
}

@media (max-width: 768px) {
    .portal-body .grid-2,
    .portal-body .grid-3,
    .portal-body .grid-4 {
        grid-template-columns: 1fr;
    }
}
.portal-body .nav-portal {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004999 100%) !important;
    color: white !important;
    padding: 0;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Portalspezifischer Header (Blauer Look) */
.portal-body .portal-header-theme {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004999 100%) !important;
    color: white !important;
    border-bottom: none !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    padding: 0.5rem 0 !important;
}

.portal-body .portal-header-theme .logo,
.portal-body .portal-header-theme .logo span,
.portal-body .portal-header-theme .logo-tagline,
.portal-body .portal-header-theme .welcome-text,
.portal-body .portal-header-theme .welcome-text strong {
    color: white !important;
}

.portal-body .portal-header-theme .nav-links a:not(.btn) {
    color: rgba(255,255,255,0.9) !important;
}

.portal-body .portal-header-theme .nav-links a:not(.btn):hover {
    color: white !important;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.portal-body .nav-portal a {
    color: white !important;
    text-decoration: none;
    padding: 16px 12px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    min-height: 54px;
}

.portal-body .nav-portal a:hover, 
.portal-body .nav-portal a.active {
    background: rgba(255,255,255,0.15);
    border-bottom-color: #ffd700;
}

/* Layout scoped */
.portal-body .container,
.portal-body .container-portal {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Reset: Prevent container padding from adding height to the header */
.portal-body .header-portal .container {
    padding-top: 0;
    padding-bottom: 0;
}

/* Cards scoped */
.portal-body .card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 25px;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Buttons scoped */
.portal-body .btn-portal,
.portal-body .btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    min-height: 44px;
}

.portal-body .btn-primary { background: var(--primary-color); color: white; }
.portal-body .btn-primary:hover { background: #0052a3; transform: translateY(-1px); }

.portal-body .btn-success { background: var(--success-color); color: white; }
.portal-body .btn-success:hover { background: #218838; transform: translateY(-1px); }

.portal-body .btn-danger { background: var(--danger-color); color: white; }
.portal-body .btn-danger:hover { background: #c82333; transform: translateY(-1px); }

.portal-body .btn-outline { background: transparent; border: 2px solid #e0e0e0; color: var(--dark-text); }
.portal-body .btn-outline:hover { background: #f8f9fa; border-color: #ccc; }

.portal-body .btn-sm { padding: 6px 16px; min-height: 32px; font-size: 12px; }

/* Form elements scoped to portal-body */
.portal-body input[type="text"],
.portal-body input[type="email"],
.portal-body input[type="password"],
.portal-body input[type="number"],
.portal-body select,
.portal-body textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    min-height: 44px;
    transition: all 0.3s ease;
    width: 100%;
    font-family: inherit;
}

/* Grid system */
.portal-body .grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.portal-body .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* Tables scoped */
.portal-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px; /* More compact */
}

/* Scrollable wrapper */
.portal-body .table-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 8px; /* Optional: matches card radius */
}

.portal-body th {
    background: #f8f9fa;
    text-align: left;
    padding: 12px 8px; /* Reduced padding */
    border-bottom: 2px solid #dee2e6;
    color: var(--dark-text);
    font-weight: 700;
    white-space: nowrap; /* Keep headers single line */
}
.portal-body td {
    padding: 12px 8px; /* Reduced padding */
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

/* ========================================
   NON-GLOBAL SELECTORS (STILL SAFE)
   ======================================== */
.login-card, .register-card, .verify-card, .reset-card, .confirmation-card, .resend-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid #eee;
    margin: 0 auto;
}

.card-header-portal {
    background: white;
    padding: 2.5rem 2rem 1rem;
    text-align: center;
}

.card-header-portal h2 {
    color: #0056b3; /* --primary-blue from style.css */
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--dark-text); font-size: 14px; }

/* Badges */
.badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }

/* Admin utils */
.icon-emoji { display: inline-block; font-size: 1.1em; margin-right: 0.5rem; vertical-align: middle; }

/* ========================================
   ALERT SYSTEM
   ======================================== */
.portal-body .alert {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border-left: 5px solid;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    animation: alertSlideIn 0.4s ease-out;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.portal-body .alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.portal-body .alert strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.portal-body .alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left-color: #28a745;
    color: #155724;
}

.portal-body .alert-success strong {
    color: #0f4419;
}

.portal-body .alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-left-color: #dc3545;
    color: #721c24;
}

.portal-body .alert-danger strong {
    color: #4d1319;
}

.portal-body .alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left-color: #ffc107;
    color: #856404;
}

.portal-body .alert-warning strong {
    color: #5a4303;
}

.portal-body .alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border-left-color: #17a2b8;
    color: #0c5460;
}

.portal-body .alert-info strong {
    color: #073a42;
}

@keyframes alertSlideIn {
    from { 
        transform: translateY(-20px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* ========================================
   MODAL SYSTEM
   ======================================== */
.portal-body .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.portal-body .modal-overlay.open {
    display: flex;
}

.portal-body .modal-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease-out;
}

.portal-body .btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    line-height: 1;
}

.portal-body .btn-close:hover {
    color: #333;
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ========================================
   ADMIN DASHBOARD STYLES
   ======================================== */
.portal-body .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.portal-body .stat {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.portal-body .stat:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.portal-body .stat .number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
    margin-bottom: 5px;
}

.portal-body .stat .label {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portal-body .stat-success .number { color: var(--success-color); }
.portal-body .stat-warning .number { color: var(--warning-color); }
.portal-body .stat-danger .number { color: var(--danger-color); }

/* Gradient Cards for Highlights */
.portal-body .card-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004999 100%);
    color: white;
    border: none;
}

.portal-body .card-gradient h2, 
.portal-body .card-gradient .text-white {
    color: white !important;
}

.portal-body .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.portal-body .stat-overlay {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.portal-body .stat-overlay .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 10px 0;
}

.portal-body .stat-overlay .small-muted {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.85rem;
}

/* Utilities */
.portal-body .flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.portal-body .flex-items-center {
    display: flex;
    align-items: center;
}

.portal-body .flex-wrap {
    flex-wrap: wrap;
}

.portal-body .grid-gap-5 { gap: 5px; }
.portal-body .grid-gap-10 { gap: 10px; }
.portal-body .grid-gap-15 { gap: 15px; }
.portal-body .grid-gap-25 { gap: 25px; }

.portal-body .mb-5 { margin-bottom: 5px; }
.portal-body .mb-10 { margin-bottom: 10px; }
.portal-body .mb-15 { margin-bottom: 15px; }
.portal-body .mb-20 { margin-bottom: 20px; }
.portal-body .mb-25 { margin-bottom: 25px; }
.portal-body .mb-30 { margin-bottom: 30px; }

.portal-body .mt-5 { margin-top: 5px; }
.portal-body .mt-10 { margin-top: 10px; }
.portal-body .mt-15 { margin-top: 15px; }
.portal-body .mt-20 { margin-top: 20px; }
.portal-body .mt-25 { margin-top: 25px; }

.portal-body .ml-5 { margin-left: 5px; }
.portal-body .ml-10 { margin-left: 10px; }
.portal-body .ml-15 { margin-left: 15px; }
.portal-body .ml-20 { margin-left: 20px; }

.portal-body .mr-5 { margin-right: 5px; }
.portal-body .mr-10 { margin-right: 10px; }
.portal-body .mr-15 { margin-right: 15px; }
.portal-body .mr-20 { margin-right: 20px; }

.portal-body .p-0 { padding: 0; }
.portal-body .p-10 { padding: 10px; }
.portal-body .p-15 { padding: 15px; }
.portal-body .p-20 { padding: 20px; }

.portal-body .pt-5 { padding-top: 5px; }
.portal-body .pt-10 { padding-top: 10px; }
.portal-body .pt-15 { padding-top: 15px; }
.portal-body .pt-20 { padding-top: 20px; }

.portal-body .pb-5 { padding-bottom: 5px; }
.portal-body .pb-10 { padding-bottom: 10px; }

.portal-body .m-0 { margin: 0; }
.portal-body .w-100 { width: 100%; }
.portal-body .text-center { text-align: center; }
.portal-body .text-right { text-align: right; }

.portal-body .fw-bold { font-weight: 700; }
.portal-body .fw-600 { font-weight: 600; }
.portal-body .fs-11 { font-size: 0.7rem; }
.portal-body .fs-14em { font-size: 1.4em; }

.portal-body .text-nowrap { white-space: nowrap; }

.portal-body .cursor-pointer { cursor: pointer; }
.portal-body .link-inline { 
    color: var(--primary-color); 
    text-decoration: none; 
    font-weight: 500;
}
.portal-body .link-inline:hover { text-decoration: underline; }

/* License Type Badges */
.portal-body .status-type-private {
    background-color: #e3f2fd;
    color: #0d47a1;
}

.portal-body .status-type-business {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid rgba(123, 31, 162, 0.2);
}

.portal-body .status-type-trial {
    background-color: #fff3cd;
    color: #856404;
}

/* Activity Status */
.portal-body .activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    display: inline-block;
}

.portal-body .activity-online {
    background-color: var(--success-color);
    box-shadow: 0 0 5px var(--success-color);
}

/* Modals */
.portal-body .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px);
}

.portal-body .modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.portal-body .modal-card {
    background: white;
    width: 100%;
    max-width: 500px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.portal-body .modal-overlay.open .modal-card {
    transform: translateY(0);
}

/* Override Card styling */
.portal-body .card-override {
    border: 1px dashed var(--primary-color);
    background: #f0f7ff;
}

/* Responsive */
@media (max-width: 992px) {
    .portal-body .container { padding: 15px; }
    .portal-body nav a { padding: 14px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
    .portal-body .btn { width: 100%; }
}

/* Fixes for distorting tables */
.portal-body .small-code {
    font-size: 11px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background: rgba(0,0,0,0.04);
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-block;
    word-break: break-all;
    max-width: 100%;
}

.portal-body td {
    vertical-align: middle;
}

/* Specific column adjustments */
.portal-body table td ul, .portal-body table td .mb-5 {
    margin-bottom: 5px;
}

/* Flex Grid System for Stats */
.portal-body .flex-grid-3 {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.portal-body .flex-grid-col {
    flex: 1;
    min-width: 250px;
}

