* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --bg: #0a0e27;
    --bg-light: #151d36;
    --bg-lighter: #1a233a;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --border: #2d3748;
    --accent: #ec4899;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-light) 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* --- Login --- */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0d1117 100%);
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: rgba(20, 25, 50, 0.95); backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 116, 139, 0.2); border-radius: 24px; padding: 50px 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    animation: slideUp 0.6s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(30px);} to { opacity: 1; transform: translateY(0);} }
.login-header { text-align: center; margin-bottom: 40px; }
.login-logo { font-size: 56px; margin-bottom: 20px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-10px);} }
.login-title {
    font-size: 32px; font-weight: 800;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 8px; letter-spacing: -0.5px;
}
.login-subtitle { font-size: 14px; color: #94a3b8; font-weight: 500; }
.lockout-message { text-align: center; color: #fca5a5; font-size: 13px; margin-top: 12px; }

/* --- Layout --- */
header {
    background: linear-gradient(135deg, rgba(20,25,50,0.8), rgba(25,35,60,0.8));
    backdrop-filter: blur(10px); padding: 32px; border-radius: 16px; margin-bottom: 32px;
    border: 1px solid rgba(100,116,139,0.2); box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
header h1 {
    font-size: 36px; font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 8px; letter-spacing: -0.5px;
}
header p { color: var(--text-dim); font-size: 14px; font-weight: 500; }
.version-badge {
    display: inline-block; background: linear-gradient(135deg, var(--success), var(--info));
    color: white; padding: 6px 14px; border-radius: 20px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; margin-left: 12px;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.nav { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.nav-link {
    padding: 12px 24px; background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3);
    border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
    transition: all 0.3s ease; cursor: pointer;
}
.nav-link:hover, .nav-link.active {
    background: var(--primary); border-color: var(--primary); transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59,130,246,0.3);
}

.card {
    background: linear-gradient(135deg, rgba(20,25,50,0.9), rgba(25,35,60,0.9));
    border: 1px solid rgba(100,116,139,0.2); border-radius: 16px; padding: 32px; margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); backdrop-filter: blur(10px);
    animation: slideInUp 0.5s ease-out;
}
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px);} to { opacity: 1; transform: translateY(0);} }
.card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
    padding-bottom: 16px; border-bottom: 1px solid rgba(100,116,139,0.2); flex-wrap: wrap; gap: 12px;
}
.card-header h2 { font-size: 22px; font-weight: 700; }

.form-group { margin-bottom: 20px; }
.form-label {
    display: block; font-weight: 700; margin-bottom: 10px; color: var(--text-dim);
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input, .form-select {
    width: 100%; padding: 14px 16px; background: rgba(15,23,42,0.6);
    border: 1px solid rgba(100,116,139,0.2); border-radius: 12px; color: var(--text);
    font-size: 14px; transition: all 0.3s ease; font-family: inherit;
}
.form-input:focus, .form-select:focus {
    outline: none; border-color: var(--primary); background: rgba(59,130,246,0.1);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.checkbox-row { display: flex; align-items: center; gap: 8px; }

.btn {
    padding: 12px 24px; border: none; border-radius: 10px; font-weight: 700; font-size: 14px;
    cursor: pointer; transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; box-shadow: 0 8px 16px rgba(59,130,246,0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(59,130,246,0.4); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: white; box-shadow: 0 8px 16px rgba(16,185,129,0.3); }
.btn-success:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(16,185,129,0.4); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: white; box-shadow: 0 8px 16px rgba(239,68,68,0.3); }
.btn-warning { background: linear-gradient(135deg, var(--warning), #d97706); color: white; box-shadow: 0 8px 16px rgba(245,158,11,0.3); }
.btn-small { padding: 8px 16px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.judgment-item {
    background: rgba(0,0,0,0.2); padding: 24px; border-radius: 12px;
    border: 1px solid rgba(100,116,139,0.2); transition: all 0.3s ease; margin-bottom: 16px;
    animation: fadeInScale 0.4s ease-out;
}
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.95);} to { opacity: 1; transform: scale(1);} }
.judgment-item:hover { border-color: var(--primary); transform: translateX(4px); box-shadow: 0 8px 20px rgba(59,130,246,0.2); }
.judgment-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.case-number { font-weight: 700; font-size: 16px; color: var(--primary); }
.court-name { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.judgment-date { color: var(--text-dim); font-size: 12px; }
.judgment-summary { color: var(--text); font-size: 14px; line-height: 1.6; margin: 12px 0; }

.analysis-result { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.3); border-radius: 12px; padding: 24px; margin-top: 20px; animation: expandDown 0.4s ease-out; }
@keyframes expandDown { from { opacity: 0;} to { opacity: 1;} }
.analysis-section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.analysis-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.section-title { font-weight: 700; font-size: 12px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 12px; letter-spacing: 0.5px; }
.thesis-list { list-style: none; padding: 0; }
.thesis-item { background: rgba(59,130,246,0.1); border-left: 3px solid var(--primary); padding: 14px 16px; margin-bottom: 10px; border-radius: 6px; line-height: 1.7; font-size: 14px; transition: all 0.3s ease; }
.thesis-item:hover { transform: translateX(6px); background: rgba(59,130,246,0.2); }
.legal-basis-list, .statute-list, .keywords { display: flex; flex-wrap: wrap; gap: 10px; }
.legal-provision, .statute-tag, .keyword-tag { background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.4); padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; color: #c4b5fd; transition: all 0.3s ease; }
.legal-provision:hover, .statute-tag:hover, .keyword-tag:hover { transform: translateY(-3px); }
.statute-tag { background: rgba(6,182,212,0.15); border-color: rgba(6,182,212,0.4); color: #67e8f9; }
.keyword-tag { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); color: #93c5fd; border-radius: 20px; }
.reasoning-text { background: rgba(245,158,11,0.1); border-left: 3px solid var(--warning); padding: 14px 16px; border-radius: 6px; line-height: 1.7; font-size: 14px; }
.argument-text { color: var(--text-dim); font-size: 13px; font-style: italic; line-height: 1.7; }

.loading { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.spinner { width: 40px; height: 40px; margin: 0 auto 16px; border: 4px solid rgba(59,130,246,0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg);} }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-box { background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.1)); padding: 24px; border-radius: 12px; border: 1px solid rgba(100,116,139,0.2); }
.stat-value { font-size: 36px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 8px; }
.stat-label { color: var(--text-dim); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }

.court-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.court-bar-label { width: 60px; color: var(--text-dim); flex-shrink: 0; }
.court-bar-track { flex: 1; background: rgba(255,255,255,0.05); border-radius: 6px; height: 18px; overflow: hidden; }
.court-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 6px; transition: width 0.6s ease; }
.court-bar-count { width: 30px; text-align: right; color: var(--text-dim); }

.alert { padding: 16px; border-radius: 12px; margin-bottom: 24px; font-size: 14px; display: flex; align-items: center; gap: 12px; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }

.search-box { position: relative; margin-bottom: 24px; }
.search-input { width: 100%; padding: 14px 48px 14px 16px; background: rgba(15,23,42,0.6); border: 2px solid rgba(100,116,139,0.2); border-radius: 12px; color: var(--text); font-size: 15px; }
.search-input:focus { border-color: var(--primary); background: rgba(59,130,246,0.1); outline: none; }
.search-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 18px; }

.filters-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0;} to { opacity: 1;} }
.empty-state h3 { font-size: 20px; margin-bottom: 12px; color: var(--text); }

.analyzed-badge { display: inline-block; background: rgba(16,185,129,0.2); border: 1px solid rgba(16,185,129,0.4); color: var(--success); padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.favorite-star { cursor: pointer; font-size: 20px; transition: transform 0.2s ease; background: none; border: none; }
.favorite-star:hover { transform: scale(1.2); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }
.pagination span { color: var(--text-dim); font-size: 13px; }

/* --- Akordeon orzeczeń (gęsta lista, rozwijana) --- */
.acc-card { padding: 12px 16px; }
.acc-list { display: flex; flex-direction: column; }
.acc-item { border-bottom: 1px solid rgba(100,116,139,0.15); }
.acc-item:last-child { border-bottom: none; }
.acc-header {
    width: 100%; display: flex; align-items: center; gap: 12px;
    background: none; border: none; color: var(--text); cursor: pointer;
    padding: 11px 8px; font-size: 13px; text-align: left; border-radius: 8px;
    transition: background 0.15s ease; text-transform: none; letter-spacing: normal; font-weight: 500;
}
.acc-header:hover { background: rgba(59,130,246,0.08); }
.acc-header.open { background: rgba(59,130,246,0.12); }
.acc-chevron {
    display: inline-block; width: 12px; flex-shrink: 0; color: var(--text-dim);
    transition: transform 0.2s ease; font-size: 11px;
}
.acc-header.open .acc-chevron { transform: rotate(90deg); color: var(--primary); }
.acc-date { color: var(--text-dim); font-size: 12px; width: 100px; flex-shrink: 0; }
.acc-court {
    color: var(--text-dim); font-size: 12px; width: 190px; flex-shrink: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acc-case {
    font-weight: 700; color: var(--primary); flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acc-badge { flex-shrink: 0; padding: 2px 10px; font-size: 9px; }
.acc-body { padding: 2px 8px 18px 32px; animation: fadeIn 0.2s ease-out; }
.acc-body .judgment-summary { margin-top: 0; }

@media (max-width: 768px) {
    .acc-court { display: none; }
    .acc-date { width: 78px; }
    .acc-body { padding-left: 20px; }
}

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); overflow: auto; backdrop-filter: blur(4px); }
.modal-content { background: linear-gradient(135deg, #1a233a 0%, #0f172a 100%); margin: 3% auto; padding: 0; border: 1px solid rgba(100,116,139,0.2); border-radius: 20px; width: 95%; max-width: 1200px; max-height: 90vh; overflow: hidden; position: relative; box-shadow: 0 25px 50px rgba(0,0,0,0.5); }
.modal-header { background: linear-gradient(135deg, var(--primary), var(--secondary)); padding: 28px 32px; position: sticky; top: 0; }
.modal-body { padding: 32px; overflow-y: auto; max-height: calc(90vh - 100px); }
.modal-close { position: absolute; right: 28px; top: 24px; font-size: 32px; font-weight: bold; color: white; cursor: pointer; background: rgba(255,255,255,0.1); width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: none; }
.modal-close:hover { background: var(--danger); transform: rotate(90deg); }
.modal-title { font-size: 28px; font-weight: 800; margin: 0; color: white; }
.modal-subtitle { font-size: 14px; color: rgba(255,255,255,0.85); margin-top: 8px; font-weight: 500; }
.judgment-full-text { background: var(--bg-light); padding: 32px; border-radius: 12px; border: 1px solid rgba(100,116,139,0.2); line-height: 2; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.notes-textarea { width: 100%; min-height: 100px; padding: 14px; background: rgba(15,23,42,0.6); border: 1px solid rgba(100,116,139,0.2); border-radius: 10px; color: var(--text); font-size: 14px; font-family: inherit; resize: vertical; margin-top: 8px; }
.notes-textarea:focus { outline: none; border-color: var(--primary); background: rgba(59,130,246,0.1); }
.user-notes-display { background: rgba(245,158,11,0.1); border-left: 3px solid var(--warning); padding: 12px 16px; border-radius: 6px; margin-top: 8px; font-style: italic; }

.logout-btn { background: linear-gradient(135deg, var(--danger), #dc2626); color: white; padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: 0.5px; display: inline-flex; align-items: center; gap: 6px; }
.logout-btn:hover { transform: translateY(-2px); }

.notification { position: fixed; bottom: 20px; right: 20px; padding: 16px 24px; background: linear-gradient(135deg, var(--success), #059669); color: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(16,185,129,0.3); animation: slideInRight 0.4s ease-out, slideOutRight 0.4s ease-out 2.6s forwards; z-index: 2000; font-weight: 600; font-size: 14px; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px);} to { opacity: 1; transform: translateX(0);} }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0);} to { opacity: 0; transform: translateX(100px);} }

html { scroll-behavior: smooth; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(15,23,42,0.5); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 10px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: rgba(59,130,246,0.4); color: var(--text); }

@media (max-width: 768px) {
    header { padding: 24px; } header h1 { font-size: 28px; }
    .nav-link { padding: 10px 16px; font-size: 13px; }
    .card { padding: 20px; }
    .judgment-header { flex-direction: column; }
    .btn-group { width: 100%; }
    .btn-small { flex: 1; min-width: 120px; }
    .modal-content { width: 98%; margin: 10% auto; }
    .modal-body { padding: 20px; }
    .container { padding: 8px; }
}
@media (max-width: 480px) {
    header h1 { font-size: 22px; } header p { font-size: 12px; }
    .version-badge { display: block; margin-left: 0; margin-top: 8px; }
    .card-header { flex-direction: column; gap: 12px; }
    .stats { grid-template-columns: 1fr; }
    .judgment-item { padding: 16px; }
    .btn { font-size: 12px; padding: 10px 16px; }
}
