/**
 * AA-Payout Stylesheet
 * Custom styling for the Fleet Payout plugin
 */

/* ========================================
   General Styles
   ======================================== */

.allianceauth-aapayout {
    padding: 20px 0;
}

/* ========================================
   Cards and Panels
   ======================================== */

.card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    font-weight: 600;
}

/* Status badges */
.badge {
    font-size: 0.875rem;
    padding: 0.375rem 0.625rem;
}

/* ========================================
   Tables
   ======================================== */

.table-responsive {
    overflow-x: auto;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.table tfoot {
    font-weight: 600;
    border-top: 2px solid #dee2e6;
}

/* Monetary values */
.table td.text-end,
.table th.text-end {
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Forms
   ======================================== */

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Loot text area styling */
.font-monospace {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
}

textarea.font-monospace {
    line-height: 1.5;
}

/* ========================================
   Character Autocomplete
   ======================================== */

#character-suggestions,
#participant-suggestions {
    position: absolute;
    z-index: 9999;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#character-suggestions .list-group-item,
#participant-suggestions .list-group-item {
    cursor: pointer;
    border-left: none;
    border-right: none;
}

#character-suggestions .list-group-item:hover,
#participant-suggestions .list-group-item:hover {
    background-color: #f8f9fa;
}

#character-suggestions .list-group-item:first-child,
#participant-suggestions .list-group-item:first-child {
    border-top: none;
}

#character-suggestions .list-group-item:last-child,
#participant-suggestions .list-group-item:last-child {
    border-bottom: none;
}

/* ========================================
   ISK Formatting
   ======================================== */

.isk-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.isk-large {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ========================================
   Status Badges
   ======================================== */

.badge.bg-draft {
    background-color: #6c757d !important;
}

.badge.bg-valuing {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge.bg-valued {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

.badge.bg-approved {
    background-color: #198754 !important;
}

.badge.bg-paid {
    background-color: #0d6efd !important;
}

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

.dashboard-summary .card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.dashboard-summary .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Fleet Detail
   ======================================== */

.fleet-participants .participant-active {
    background-color: #d1e7dd;
}

.fleet-participants .participant-left {
    background-color: #f8d7da;
    opacity: 0.7;
}

/* ========================================
   Loot Pool Detail
   ======================================== */

.loot-item-manual-override {
    background-color: #fff3cd;
}

.loot-item-table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ========================================
   Payout Management
   ======================================== */

.payout-pending {
    border-left: 4px solid #ffc107;
}

.payout-paid {
    border-left: 4px solid #198754;
}

.payout-failed {
    border-left: 4px solid #dc3545;
}

/* ========================================
   Buttons
   ======================================== */

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn .fas,
.btn .fa {
    margin-right: 0.25rem;
}

/* ========================================
   Loading States
   ======================================== */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Alerts and Messages
   ======================================== */

.alert {
    border-radius: 0.375rem;
}

.alert i {
    margin-right: 0.5rem;
}

/* ========================================
   Raw Loot Text Display
   ======================================== */

pre.loot-raw-text {
    background-color: #2d2d2d;
    color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

/* ========================================
   Pagination
   ======================================== */

.pagination {
    margin-top: 1.5rem;
}

.pagination .page-link {
    color: #0d6efd;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .btn-group-sm .btn {
        padding: 0.125rem 0.25rem;
        font-size: 0.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .display-6 {
        font-size: 2rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .btn,
    .pagination,
    .card-header .dropdown,
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .table {
        font-size: 0.875rem;
    }
}

/* ========================================
   Utilities
   ======================================== */

.text-monospace {
    font-family: 'Courier New', Courier, monospace;
}

.text-nowrap {
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

/* Small helper for right-aligned numeric columns */
.numeric-column {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Highlight current user's payouts */
.highlight-self {
    background-color: #cfe2ff;
}

/* ========================================
   Workflow Progress Indicator
   ======================================== */

.workflow-progress {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.workflow-step .step-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

.workflow-step.completed .step-icon {
    color: #198754;
}

.workflow-step.active .step-icon {
    color: #0d6efd;
    animation: pulse 2s infinite;
}

.workflow-step.pending .step-icon {
    color: #adb5bd;
}

.workflow-step .step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6c757d;
    text-align: center;
}

.workflow-step.completed .step-label {
    color: #198754;
}

.workflow-step.active .step-label {
    color: #0d6efd;
    font-weight: 600;
}

.step-connector {
    flex: 1;
    height: 3px;
    background-color: #dee2e6;
    margin: 0 0.5rem;
    margin-top: -1rem;
    border-radius: 2px;
    transition: background-color 0.3s ease;
}

.step-connector.completed {
    background-color: #198754;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* ========================================
   Payout Calculator Card
   ======================================== */

.payout-breakdown {
    border: 1px solid #dee2e6;
}

.payout-breakdown table {
    background: transparent;
}

.payout-breakdown .table > :not(caption) > * > * {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0.75rem;
}

.payout-breakdown .table-primary > * {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.payout-breakdown .table-light > * {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

/* Scout Bonus Control */
.scout-bonus-control {
    border: 1px solid #dee2e6;
}

.scout-bonus-control .form-range::-webkit-slider-thumb {
    background: #0d6efd;
}

.scout-bonus-control .form-range::-moz-range-thumb {
    background: #0d6efd;
}

/* Action Buttons Group */
.action-buttons .btn {
    transition: all 0.2s ease;
}

.action-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Fleet Details Card (Left Column)
   ======================================== */

.accordion-button.bg-transparent {
    background-color: transparent !important;
    box-shadow: none;
    padding: 0.5rem 0;
    font-weight: 500;
}

.accordion-button.bg-transparent:not(.collapsed) {
    color: #0d6efd;
}

.accordion-button.bg-transparent::after {
    width: 1rem;
    height: 1rem;
    background-size: 1rem;
}

/* ========================================
   Participant Table Improvements
   ======================================== */

.participant-table {
    border-collapse: separate;
    border-spacing: 0;
}

.participant-table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    vertical-align: middle;
    white-space: nowrap;
}

.participant-table thead th[title],
.participant-table thead th.controls-header {
    cursor: help;
}

.participant-table thead th.controls-header {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
}

.participant-table tbody td {
    vertical-align: middle;
}

/* Visual grouping for related columns */
.participant-table thead th.border-end-0 {
    border-right: none;
}

.participant-table thead th.border-start-0 {
    border-left: none;
}

.table .btn-group-sm .btn {
    padding: 0.2rem 0.4rem;
}

/* Copy on click feedback */
.copy-on-click {
    transition: background-color 0.2s ease;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

.copy-on-click:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.copy-on-click.copied {
    background-color: rgba(25, 135, 84, 0.2);
}

/* Scout badge styling */
.badge.bg-info i.fa-binoculars {
    font-size: 0.7rem;
}

/* Participant row hover enhancement */
.participant-table tbody tr:hover:not(.table-secondary) {
    background-color: rgba(13, 110, 253, 0.04);
}

/* Excluded participant styling */
.participant-table tbody tr.table-secondary {
    opacity: 0.7;
}

.participant-table tbody tr.table-secondary td {
    text-decoration: line-through;
    text-decoration-color: rgba(0, 0, 0, 0.3);
}

.participant-table tbody tr.table-secondary td:last-child,
.participant-table tbody tr.table-secondary td .form-check-input {
    text-decoration: none;
}

/* Checkbox styling in table */
.participant-table .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.participant-table .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.participant-table .scout-checkbox:checked {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.participant-table .exclude-checkbox:checked {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* ========================================
   Empty State Styling
   ======================================== */

.card-body .fa-3x {
    opacity: 0.5;
}

.card-body .text-center p {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Responsive Adjustments for New Layout
   ======================================== */

@media (max-width: 768px) {
    .workflow-progress {
        padding: 0.75rem 1rem;
    }

    .workflow-step {
        min-width: 60px;
    }

    .workflow-step .step-icon {
        width: 24px;
        height: 24px;
        font-size: 0.875rem;
    }

    .workflow-step .step-label {
        font-size: 0.65rem;
    }

    .step-connector {
        margin: 0 0.25rem;
        margin-top: -0.75rem;
    }

    .payout-breakdown {
        padding: 0.75rem !important;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn-group,
    .action-buttons form {
        width: 100%;
    }

    .action-buttons .btn {
        width: 100%;
    }

    /* Stack columns on mobile */
    .col-md-4,
    .col-md-8 {
        margin-bottom: 1rem;
    }
}
