/* ===== Podstawowe style ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
    min-height: 100vh;
}

/* ===== Modern NavBar ===== */
.navbar-dark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link {
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem !important;
    margin: 0 0.25rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid white;
}

.btn-outline-light {
    border: 2px solid white !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s ease !important;
}

.btn-outline-light:hover {
    background: white !important;
    color: #667eea !important;
    transform: translateY(-2px);
}

h1 {
    color: #212529;
    margin-bottom: 1.5rem;
}

h1:focus {
    outline: none;
}

/* ===== Formularze i walidacja ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

/* ===== Błędy Blazor ===== */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPj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2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ===== Checkboxy ===== */
.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

input[type="checkbox"] {
    cursor: pointer;
    width: 1.2rem;
    height: 1.2rem;
}

/* ===== Modern Cards ===== */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    border-radius: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    font-weight: 700;
    padding: 1.25rem 1.5rem;
    border-radius: 1rem 1rem 0 0;
}

.card-header h5 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Modern Tables ===== */
.table {
    background-color: white;
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #667eea;
    font-weight: 700;
    white-space: nowrap;
    color: #495057;
    padding: 1rem;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f8f9fa;
}

.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.08);
    transform: scale(1.01);
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

/* ===== Modern Alerts ===== */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

/* ===== Modern Buttons ===== */
.btn {
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.625rem 1.25rem;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    box-shadow: 0 4px 6px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #4e555b 100%);
    box-shadow: 0 6px 12px rgba(108, 117, 125, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 4px 6px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 6px 12px rgba(220, 53, 69, 0.4);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

/* ===== Modern Forms ===== */
.form-control, .form-select {
    border: 2px solid #e0e6ed;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ===== Spinner ===== */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ===== Modal ===== */
.modal.show {
    display: block;
}

/* ===== Kafelki zadań ===== */
.company-card {
    margin-bottom: 2rem;
}

.company-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
}

.company-card .card-header h5 {
    color: white;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.company-card .card-header .badge {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
}

.task-tile {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
}

.task-tile:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.task-tile.completed {
    background: #f0fdf4;
    border-color: #22c55e;
}

.task-tile.completed:hover {
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.task-tile-icon {
    font-size: 2.5rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.task-tile-icon .bi-check-circle-fill {
    color: #22c55e;
}

.task-tile-icon .bi-circle {
    color: #d1d5db;
}

.task-tile-content {
    flex: 1;
}

.task-tile-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.task-tile-step {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.task-tile-date {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
}

/* ===== Grid układowy dla tasków ===== */
.accounting-grid {
    margin-bottom: 0;
    table-layout: fixed;
    width: 100%;
}

/* Fixed header table */
.accounting-header-table-container {
    position: relative;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-bottom: none;
}

.accounting-header-table {
    width: 100%;
    margin-bottom: 0 !important;
}

.accounting-header-table thead th {
    background-color: #f8f9fa !important;
    vertical-align: middle;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 2px solid #dee2e6 !important;
    position: relative;
}

/* Scrollable body table */
.accounting-body-table-container {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-top: none;
}

.accounting-body-table {
    width: 100%;
    margin-bottom: 0 !important;
}

.accounting-body-table thead {
    visibility: hidden;
    height: 0;
    line-height: 0;
}

.accounting-body-table thead th {
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
}

.accounting-grid .order-col {
    width: 70px;
}

.accounting-grid .company-col:first-of-type {
    width: 120px;
}

.accounting-grid .company-col:nth-of-type(2) {
    width: 240px;
}

.accounting-grid .task-col {
    font-weight: 600;
    color: #667eea;
    transition: background-color 0.3s ease;
    width: auto;
    min-width: 100px;
    white-space: nowrap;
}

.accounting-grid .task-col.task-completed {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.accounting-grid .actions-col {
    width: 80px;
}

.accounting-grid .task-cell {
    padding: 0.5rem;
    vertical-align: middle;
}

.task-tile-mini {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.5rem;
    background: #fef2f2;
    border: 2px solid #ef4444;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    min-height: 80px;
}

.task-tile-mini:last-child {
    margin-bottom: 0;
}

.task-tile-mini:hover {
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.task-tile-mini > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.task-tile-mini.completed {
    background: #f0fdf4;
    border-color: #22c55e;
}

.task-tile-mini.completed:hover {
    border-color: #16a34a;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.task-tile-mini.disabled {
    background: #f3f4f6;
    border-color: #9ca3af;
    opacity: 0.6;
}

.task-tile-mini.disabled:hover {
    border-color: #6b7280;
    box-shadow: 0 2px 8px rgba(156, 163, 175, 0.2);
}

.task-tile-mini-icon {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.task-tile-mini-icon .bi-check-circle-fill {
    color: #22c55e;
}

.task-tile-mini-icon .bi-circle {
    color: #ef4444;
}

.task-tile-mini-icon .bi-slash-circle {
    color: #9ca3af;
}

.task-tile-mini-step {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.task-tile-mini-date {
    font-size: 0.65rem;
    color: #9ca3af;
    text-align: center;
}

.task-tile-mini-user {
    font-size: 0.6rem;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
    margin-top: 0.15rem;
}

/* ===== Dashboard Styles ===== */

/* Task Progress Tiles - Horizontal Layout */
.task-tiles-horizontal {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.task-tile-dashboard {
    flex: 1 1 0;
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    color: white;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    min-height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.task-tile-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.task-tile-overall {
    flex: 2 1 0;
}

.task-tile-overall .task-tile-dashboard-name {
    font-weight: 800 !important;
    font-size: 0.8rem !important;
}

.task-tile-overall .task-tile-dashboard-percent {
    font-weight: 800 !important;
    font-size: 0.75rem !important;
}

.task-tile-dashboard-icon {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    opacity: 0.95;
}

.task-tile-dashboard-name {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    line-height: 1.2;
    opacity: 0.95;
}

.task-tile-dashboard-percent {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Old inline styles */
.task-tile-inline {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    color: white;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
    min-width: auto;
    max-width: fit-content;
}

.task-tile-inline:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Old Grid Styles - Kept for backward compatibility */
.task-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.task-tile-compact {
    padding: 1.25rem;
    border-radius: 0.75rem;
    color: white;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.task-tile-compact:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.task-tile-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.task-tile-percentage {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.task-tile-count {
    font-size: 0.85rem;
    opacity: 0.9;
}

.overall-progress-tile {
    padding: 1.5rem;
    border-radius: 0.75rem;
    color: white;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.overall-label {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.overall-percentage {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.overall-details {
    font-size: 1rem;
    opacity: 0.95;
}

/* Activity Log */
.activity-log-container {
    max-height: calc(100vh - 350px);
    min-height: 300px;
    overflow-y: auto;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    padding: 1rem;
    background: white;
    border-left: 4px solid #6c757d;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.activity-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.activity-item.activity-completed {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

.activity-item.activity-uncompleted {
    border-left-color: #f97316;
    background: #fff7ed;
}

.activity-item.activity-note {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

.activity-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.activity-content {
    flex: 1;
}

.activity-header {
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.9rem;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.activity-timestamp {
    font-size: 0.8rem;
}

/* Chat Styles */
.chat-card {
    height: calc(100vh - 200px);
    max-height: 800px;
    display: flex;
    flex-direction: column;
}

.chat-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Chat Full Height - for Dashboard */
.chat-card-full {
    height: calc(100vh - 200px);
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.chat-card-full .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.chat-messages-container-full {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    min-height: 0;
}

.chat-message {
    margin-bottom: 1rem;
    max-width: 80%;
}

.chat-message-own {
    margin-left: auto;
}

.chat-message-other {
    margin-right: auto;
}

.chat-message-header {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.chat-message-own .chat-message-header {
    text-align: right;
}

.chat-message-body {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
}

.chat-message-own .chat-message-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-other .chat-message-body {
    background: white;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 0.25rem;
}

.chat-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid #dee2e6;
}

.chat-input-container .input-group {
    display: flex;
}

.chat-input-container .form-control {
    border-radius: 1.5rem 0 0 1.5rem;
    border-right: none;
}

.chat-input-container .btn {
    border-radius: 0 1.5rem 1.5rem 0;
    padding: 0.5rem 1.5rem;
}

/* ===== Responsywność ===== */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }

    input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
    }

    .task-tile {
        padding: 1rem;
        min-height: 80px;
    }

    .task-tile-icon {
        font-size: 2rem;
        margin-right: 0.75rem;
    }

    .task-tile-name {
        font-size: 1rem;
    }

    .accounting-grid .company-col:first-of-type {
        width: 80px;
    }

    .accounting-grid .company-col:nth-of-type(2) {
        width: 160px;
    }

    .accounting-grid .task-col {
        font-size: 0.75rem;
    }

    .task-tile-mini {
        padding: 0.5rem 0.25rem;
        min-height: 50px;
    }

    .task-tile-mini-icon {
        font-size: 1.25rem;
    }

    .task-tile-mini-step {
        font-size: 0.65rem;
    }

    .task-tile-mini-date {
        font-size: 0.6rem;
    }
}
