/* Hovedstyling for ROS-analyse verktøy */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: #222;
    background-color: #fff;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    background: white;
    padding: 40px 60px;
    border-radius: 0;
    box-shadow: none;
}

@media (min-width: 1800px) {
    .container {
        max-width: 1700px;
    }
}

/* Typography */
h2 {
    color: #222;
    margin-bottom: 25px;
    margin-top: 50px;
    font-size: 1.8em;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    color: #333;
    margin-bottom: 15px;
    margin-top: 30px;
    font-size: 1.3em;
    font-weight: 600;
}

/* Header */
header {
    text-align: left;
    margin-bottom: 50px;
    padding-bottom: 0;
    border-bottom: none;
}

.topbar,
.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

header h1 {
    color: #222;
    font-size: 2.2em;
    margin-bottom: 15px;
    font-weight: 600;
}

.subtitle {
    color: #555;
    font-size: 1.05em;
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s;
    margin: 5px;
    font-weight: 500;
    background-color: white;
    color: #333;
}

.btn-primary {
    background-color: #2e5f8e;
    color: white;
    border-color: #2e5f8e;
}

.btn-primary:hover {
    background-color: #1f4468;
    border-color: #1f4468;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

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

.btn-danger {
    background-color: #dc3545;
    color: white;
}

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

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 16px;
    min-width: 38px;
    line-height: 1;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.btn-icon-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn-comment {
    background: #17a2b8;
    color: white;
}

.btn-comment:hover {
    background: #138496;
}

.btn-comment.has-comments {
    background: #28a745;
}

.btn-comment.has-comments::after {
    content: ' (' attr(data-count) ')';
    font-size: 10px;
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Analyser liste */
.analyses-section {
    margin-top: 30px;
}

.analyses-section h2 {
    color: #222;
    margin-bottom: 30px;
    margin-top: 50px;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 1.8em;
    font-weight: 600;
}

.analyses-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.analysis-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.3s;
}

.analysis-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.analysis-card h3 {
    color: #007bff;
    margin-bottom: 10px;
}

.analysis-meta {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.analysis-info {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.analysis-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2em;
}

/* Editor header */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.saved-indicator {
    color: #28a745;
    font-weight: bold;
    display: none;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 0.95rem;
}

.language-select {
    min-width: 72px;
    padding: 8px 10px;
    border: 1px solid #d5dbe1;
    border-radius: 8px;
    background: #fff;
    color: #222;
}

/* Metadata seksjon */
.metadata-section {
    margin-bottom: 50px;
    padding: 0 0 30px 0;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid #e8e8e8;
}

.metadata-section h1 {
    color: #222;
    margin-bottom: 25px;
    outline: none;
    padding: 5px;
    border-radius: 2px;
    font-size: 2.2em;
    font-weight: 600;
}

.metadata-section h1:focus {
    background: #fafafa;
    box-shadow: 0 0 0 2px #d0d0d0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-top: 30px;
}

@media (max-width: 900px) {
    .topbar,
    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: space-between;
    }

    .language-switcher {
        justify-content: space-between;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.form-control {
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    font-size: 15px;
    font-family: inherit;
    background-color: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

textarea.form-control {
    resize: vertical;
}

/* Seksjoner */
section {
    margin-bottom: 40px;
}

section h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

/* Export seksjon */
.export-section {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.export-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.acceptance-level-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

.acceptance-level-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #333;
}

.acceptance-level-controls {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.acceptance-level-controls .form-group {
    margin: 0;
    flex: 0 0 auto;
}

.acceptance-level-controls .form-group label {
    display: block;
    margin-bottom: 8px;
}

.export-preview {
    background: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid #d0d0d0;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    height: 40px;
}

.acceptance-level-controls button {
    margin: 0;
}

.btn-highlight {
    background-color: #1a4d6e !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(46, 95, 142, 0.3);
}

.btn-highlight:hover {
    background-color: #153d57 !important;
    box-shadow: 0 4px 12px rgba(46, 95, 142, 0.4);
}

/* Bank administrasjon */
.bank-admin-section {
    margin-top: 50px;
    padding: 30px 0;
    border-top: 1px solid #e8e8e8;
}

.bank-admin-section h2 {
    margin-bottom: 15px;
}

.section-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.bank-upload {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.upload-status {
    font-size: 14px;
    font-weight: 500;
}

.custom-banks-list {
    margin-top: 20px;
}

.custom-banks-list h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.no-banks {
    color: #999;
    font-style: italic;
    padding: 15px;
}

.bank-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #fff;
    transition: box-shadow 0.2s;
}

.bank-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bank-info {
    flex: 1;
}

.bank-info strong {
    display: block;
    font-size: 16px;
    margin-bottom: 5px;
    color: #222;
}

.bank-info p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.bank-info small {
    color: #999;
    font-size: 13px;
}

/* Egendefinert tekstseksjon */
.custom-text-section {
    margin-top: 50px;
    padding: 30px 0;
    border-top: 1px solid #e8e8e8;
}

.custom-text-section .editable-title {
    cursor: text;
    padding: 5px;
    border-radius: 2px;
    transition: background 0.2s;
}

.custom-text-section .editable-title:hover {
    background: #f8f8f8;
}

.custom-text-section .editable-title:focus {
    background: #fafafa;
    box-shadow: 0 0 0 2px #d0d0d0;
    outline: none;
}

.custom-text-area {
    min-height: 150px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.text-muted {
    color: #999;
    font-size: 0.85em;
    display: block;
    margin-top: 10px;
}

/* Statistikk seksjon */
.stats-section {
    margin-top: 50px;
    padding: 30px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-percent {
    font-size: 0.85em;
    color: #999;
    font-style: italic;
}

.stat-card.stat-red {
    background: #ffe6e6;
    border-color: #dc3545;
}

.stat-card.stat-red .stat-value {
    color: #dc3545;
}

.stat-card.stat-orange {
    background: #fff4e6;
    border-color: #fd7e14;
}

.stat-card.stat-orange .stat-value {
    color: #fd7e14;
}

.stat-card.stat-yellow {
    background: #fffbeb;
    border-color: #ffc107;
}

.stat-card.stat-yellow .stat-value {
    color: #f59f00;
}

.stat-card.stat-green {
    background: #e6f7e6;
    border-color: #28a745;
}

.stat-card.stat-green .stat-value {
    color: #28a745;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.chart-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.chart-box h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    margin-top: 0;
    color: #333;
}

.chart-box canvas {
    max-width: 100%;
    height: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .analyses-list {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
}
