/* PRH YTJ Hallintasivu - Tyylit */

:root {
    --primary-color: #035ca7;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --gray: #6c757d;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #212529;
    --background: #ffffff;
}

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

/* Skip-to-content link (WCAG 2.1 Accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

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

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

/* Navbar */
.navbar {
    background: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.2);
}

/* Main content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Cards */
.card {
    background: var(--background);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--background);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    margin: 0;
    color: var(--primary-color);
}

.stat-content p {
    color: var(--gray);
    margin: 0;
}

/* Charts */
.chart {
    padding: 1rem 0;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.chart-label {
    min-width: 150px;
    font-weight: 500;
}

.chart-bar-container {
    flex: 1;
    position: relative;
    height: 30px;
    background: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.chart-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

/* Forms */
.search-form {
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #024a8a;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    background: var(--light-gray);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Estä Y-tunnuksen rivittyminen (ensimmäinen sarake) */
td:first-child {
    white-space: nowrap;
}

tr:hover {
    background: var(--light-gray);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: var(--text-color);
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.badge-gray {
    background: var(--gray);
    color: white;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    font-style: italic;
}

/* Pagination */
#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-table {
    width: 100%;
}

.info-table td:first-child {
    font-weight: 600;
    width: 40%;
}

.info-item {
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

/* Company Details */
.company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background: var(--text-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer a {
    color: white;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .chart-label {
        min-width: 100px;
        font-size: 0.9rem;
    }
}


/* Lajiteltavat sarakeotsiikot */
th.sortable {
    position: relative;
    user-select: none;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

th.sortable:active {
    background-color: rgba(0, 102, 204, 0.2);
}

th.sortable span {
    font-size: 0.9em;
    margin-left: 0.3rem;
}

/* Dynaamiset lajittelukriteerit */
#sort-criteria-container .form-row {
    background: #f8f9fa;
    padding: 0.8rem;
    border-radius: 6px;
    border-left: 3px solid #0066cc;
    transition: all 0.2s;
}

#sort-criteria-container .form-row:hover {
    background: #e9ecef;
    border-left-color: #0052a3;
}

#sort-criteria-container .form-row:first-child {
    border-left-color: #0066cc;
    background: #e7f3ff;
}

#sort-criteria-container .form-row:first-child:hover {
    background: #d4e9ff;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Kielivalitsin navigaatiossa */
.language-selector {
    margin-left: auto;
}

.language-select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.language-select:hover {
    border-color: #0066cc;
    background: #f0f7ff;
}

.language-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

/* Toimintopainikkeet taulukossa */
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    display: inline-block;
    text-decoration: none;
    border-radius: 3px;
    transition: all 0.2s;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Spinner animaatio */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Disabled button tyyli */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Hae-painikkeen kiinteä leveys ettei muutu haun aikana */
#search-btn {
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Admin styles */
.admin-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-badge {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.logout-link {
    color: #ef4444;
    font-size: 12px;
    text-decoration: none;
}
.logout-link:hover {
    text-decoration: underline;
}
.admin-link {
    text-decoration: none;
    font-size: 18px;
    opacity: 0.6;
    transition: opacity 0.3s;
}
.admin-link:hover {
    opacity: 1;
}
