/* assets/css/style.css */
:root {
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #596a7b;
    --link-color: #0056b3;
    --link-hover-color: #003d82;
    --border-color: #e2e8f0;
    --header-bg: #ffffff;
    --primary-color: #0056b3;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 15px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.high-contrast {
    --bg-color: #000000;
    --card-bg: #000000;
    --text-color: #ffffff;
    --text-muted: #dddddd;
    --link-color: #ffff00;
    --link-hover-color: #ffcc00;
    --border-color: #ffffff;
    --header-bg: #1a1a1a;
    --primary-color: #000000;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-hover: none;
    --border-radius: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

a {
    color: var(--link-color);
    text-decoration: underline;
    transition: color 0.2s ease-in-out;
}

a:hover, a:focus {
    color: var(--link-hover-color);
}

a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 4px solid #ffcc00;
    outline-offset: 2px;
}

body.high-contrast a:focus,
body.high-contrast button:focus,
body.high-contrast input:focus,
body.high-contrast select:focus,
body.high-contrast textarea:focus {
    outline: 4px solid #00ffff;
}

/* Accessibility Toolbar */
#accessibility-toolbar {
    background: var(--header-bg);
    padding: 10px 20px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

body.high-contrast #accessibility-toolbar {
    background: #333;
}

#accessibility-toolbar button {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9em;
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}

#accessibility-toolbar button:hover, #accessibility-toolbar button:focus {
    background: var(--bg-color);
    border-color: var(--text-color);
}

body.high-contrast #accessibility-toolbar button {
    border-color: #ffffff;
    color: #ffffff;
}

/* Header */
#main-header, #admin-header {
    background: var(--header-bg);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container img {
    height: 60px;
    margin-right: 20px;
}

.logo-container h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-color);
}

.gov-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.gov-link br {
    display: none;
}

.gov-link a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    text-decoration: none;
    padding: 10px 15px;
    border: 2px solid var(--link-color);
    border-radius: var(--border-radius);
    transition: background 0.2s, color 0.2s;
    box-sizing: border-box;
    white-space: nowrap;
    text-align: center;
}

.gov-link a:hover, .gov-link a:focus {
    background: var(--link-color);
    color: #ffffff;
}

body.high-contrast .gov-link a {
    border-color: var(--link-color);
    color: var(--link-color);
}
body.high-contrast .gov-link a:hover {
    background: var(--link-color);
    color: #000;
}

/* Main Layout */
.container {
    display: flex;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    gap: 30px;
}

#sidebar {
    width: 280px;
    flex-shrink: 0;
}

#sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}

#sidebar ul li {
    margin-bottom: 5px;
}

#sidebar ul li a, #sidebar ul li .menu-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: background 0.2s, box-shadow 0.2s;
}

#sidebar ul li a:hover, #sidebar ul li a:focus,
#sidebar ul li .menu-item-header:hover, #sidebar ul li .menu-item-header:focus-within {
    background-color: var(--bg-color);
    box-shadow: var(--shadow-sm);
}

#sidebar ul li .menu-item-header a {
    padding: 0;
    border: none;
    background: none;
    flex-grow: 1;
}
#sidebar ul li .menu-item-header a:hover {
    box-shadow: none;
    background: none;
}

.submenu-toggle {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.submenu-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}
.submenu-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

body.high-contrast .submenu-toggle {
    color: #fff;
}

/* Submenus */
#sidebar ul .submenu {
    display: none;
    margin: 5px 0 5px 15px;
    border-left: 2px solid var(--border-color);
    padding-left: 10px;
}
#sidebar ul .submenu.expanded {
    display: block;
}

#content {
    flex-grow: 1;
    min-width: 0;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 20px;
    padding: 12px 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.breadcrumbs li {
    display: inline;
}

.breadcrumbs li + li::before {
    content: "/";
    margin: 0 10px;
    color: var(--text-muted);
}

.breadcrumbs a {
    text-decoration: none;
    color: var(--link-color);
}
.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs a[aria-current="page"] {
    font-weight: 600;
    color: var(--text-color);
    pointer-events: none;
}

/* Search Bar */
.search-bar {
    margin-bottom: 30px;
}

.search-bar form {
    display: flex;
    gap: 10px;
}

input[type="text"], input[type="email"], input[type="password"], textarea, select {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 44px;
}

/* Login Page Styling */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    padding: 20px;
    box-sizing: border-box;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.login-card h2 {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
    font-size: 1.5rem;
    color: var(--text-color);
}

.login-error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

body.high-contrast .login-error {
    background-color: #000;
    color: #ff0000;
    border-color: #ff0000;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.login-card button[type="submit"] {
    width: 100%;
    min-height: 44px;
    margin-top: 10px;
}

.search-bar input[type="text"] {
    flex-grow: 1;
}

button, .btn {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-block;
    text-decoration: none;
}

button:hover, button:focus, .btn:hover, .btn:focus {
    background-color: var(--link-hover-color);
    color: #ffffff;
}

button:active, .btn:active {
    transform: scale(0.98);
}

body.high-contrast button, body.high-contrast .btn {
    background-color: var(--link-color);
    color: #000;
}
body.high-contrast button:hover, body.high-contrast .btn:hover {
    background-color: var(--link-hover-color);
}

/* Cards */
.info-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.info-card h2, .info-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color);
}

.bip-instructions {
    border-left: 4px solid var(--primary-color);
}

body.high-contrast .bip-instructions {
    border-left-color: var(--link-color);
}

/* Article List */
.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 20px;
}

.article-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.article-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.article-card h3 a {
    text-decoration: none;
    color: var(--link-color);
}
.article-card h3 a:hover {
    text-decoration: underline;
}

.article-card .article-excerpt {
    margin: 10px 0;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
}

.article-card .meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.article-card .meta strong {
    color: var(--text-color);
}

/* Metryczka Widget */
.metryczka-widget {
    margin-top: 50px;
    padding: 25px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.metryczka-widget h4 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.metryczka-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px 30px;
}

.metryczka-item {
    display: flex;
    flex-direction: column;
}

.metryczka-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 3px;
}

.metryczka-value {
    font-size: 1rem;
    color: var(--text-color);
}

/* Footer */
#main-footer {
    background: var(--header-bg);
    padding: 40px 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    gap: 30px;
    margin-bottom: 20px;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h3 {
    margin-top: 0;
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.footer-section p {
    margin: 5px 0;
    color: var(--text-muted);
}
.footer-section strong {
    color: var(--text-color);
}

.footer-bottom {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links a {
    margin-right: 15px;
    color: var(--text-muted);
    text-decoration: none;
}
.footer-links a:hover {
    color: var(--link-color);
    text-decoration: underline;
}

/* Admin Styles */
#admin-header {
    background-color: var(--card-bg);
}
#admin-header .admin-info {
    display: flex;
    flex-direction: column;
}
#admin-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-color);
}
#admin-header p {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
#admin-header .admin-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}
#admin-header .admin-actions a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
#admin-header .admin-actions a:hover {
    text-decoration: underline;
}
#admin-header .admin-actions a.btn-logout {
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    transition: background 0.2s, color 0.2s;
}
#admin-header .admin-actions a.btn-logout:hover {
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
}
body.high-contrast #admin-header .admin-actions a.btn-logout {
    border-color: var(--link-color);
    color: var(--link-color);
}
body.high-contrast #admin-header .admin-actions a.btn-logout:hover {
    background: var(--link-color);
    color: #000;
}

/* Data Tables */
table.data-table, .admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    margin-bottom: 25px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table.data-table th, .admin-table th {
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

table.data-table td, .admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: middle;
}

table.data-table tr:last-child td, .admin-table tr:last-child td {
    border-bottom: none;
}

table.data-table tr:hover, .admin-table tr:hover {
    background-color: var(--bg-color);
}

body.high-contrast table.data-table,
body.high-contrast .admin-table {
    border-color: #fff;
}

body.high-contrast table.data-table th,
body.high-contrast .admin-table th,
body.high-contrast table.data-table td,
body.high-contrast .admin-table td {
    border-color: #fff;
}

/* Utilities */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        margin-bottom: 20px;
    }
    #main-header, #admin-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    .gov-link {
        align-items: center;
    }
    .logo-container {
        flex-direction: column;
    }
    .logo-container img {
        margin-right: 0;
        margin-bottom: 10px;
    }
    .footer-content {
        flex-direction: column;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
