/* PESEL Modern & Custom Style System */

:root {
    --primary-color: #2563eb;       /* Royal Blue */
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;     /* Slate */
    --success-color: #16a34a;       /* Green */
    --warning-color: #ca8a04;       /* While/Yellow */
    --danger-color: #dc2626;        /* Red */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

/* --- Layout Components --- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Only cards that are links should have hover effects */
a.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3, .card-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.card-body {
    padding: 24px;
    flex: 1;
}

/* --- Navigation --- */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 20px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px; /* Tight gap, padding handles spacing */
    background: #ffffff;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: #f8fafc;
    color: var(--text-main);
}

.nav-link.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.nav-link i {
    font-size: 1rem;
    opacity: 0.8;
}

.nav-separator {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 4px;
}

/* Admin Link Special Style */
.nav-link-admin {
    color: #7c3aed;
}
.nav-link-admin:hover {
    background-color: #f5f3ff;
    color: #6d28d9;
}
.nav-link-admin.active {
    background-color: #f5f3ff;
    color: #6d28d9;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .header-nav {
        order: 3; /* Move nav below logic logo/user actions if needed, or just keep flow */
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .header-actions {
        position: absolute;
        top: 20px;
        right: 24px;
    }
}

/* --- Dashboard Specifics --- */

.welcome-banner {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1;
}

/* --- Forms & Inputs --- */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    box-sizing: border-box; /* Important fix */
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
    background: white;
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background-color: #f8fafc;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* --- Tables --- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: #f8fafc;
}

/* --- Timeline Visuals (Meldunki) --- */
.timeline-item {
    position: relative;
    padding-left: 24px;
    margin-bottom: 16px;
    border-left: 2px solid var(--border-color);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--text-muted);
}

.timeline-item.active {
    border-left-color: var(--success-color);
}

.timeline-item.active::before {
    border-color: var(--success-color);
    background: var(--success-color);
}