/* ===== INDIVISIBLE GOODS INTERFACE STYLES ===== */

/* Base interface container */
.indivisible-goods-interface {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 2rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-in-out;
}

.indivisible-goods-interface.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ===== BIDDING INTERFACE STYLES ===== */

.bidding-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3182ce;
}

.bidding-header h3 {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.bidding-header p {
    color: #718096;
    font-size: 1rem;
    margin: 0;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.item-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3182ce, #63b3ed);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.item-card:hover::before {
    transform: scaleX(1);
}

.item-card:hover {
    border-color: #3182ce;
    box-shadow: 0 8px 16px rgba(49, 130, 206, 0.15);
    transform: translateY(-2px);
}

.item-info {
    margin-bottom: 1.5rem;
}

.item-info h4 {
    color: #2d3748;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.item-info p {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.item-info small {
    color: #a0aec0;
    font-size: 0.8rem;
    font-weight: 500;
}

.bid-input-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.player-bid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

.player-bid:last-child {
    margin-bottom: 0;
}

.player-bid label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
    min-width: 80px;
}

.bid-input {
    width: 140px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: right;
    font-weight: 500;
    transition: all 0.2s ease;
}

.bid-input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
    background: white;
}

.bid-input:invalid,
.bid-input.invalid {
    border-color: #e53e3e;
    background-color: #fed7d7;
}

.bidding-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.primary-btn {
    background: #3182ce;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.primary-btn:hover:not(:disabled) {
    background: #2c5aa0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.primary-btn:disabled {
    background: #cbd5e0;
    color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== MARKER PLACEMENT INTERFACE STYLES ===== */

.marker-header {
    text-align: center;
    margin-bottom: 2rem;
}

.marker-header h3 {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.marker-header p {
    color: #718096;
    font-size: 1rem;
    margin: 0;
}

.linear-arrangement {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.goods-line {
    position: relative;
    height: 80px;
    background: linear-gradient(90deg,
    #e3f2fd 0% 15%,
    #fff3e0 15% 40%,
    #f3e5f5 40% 60%,
    #e8f5e8 60% 78%,
    #ffebee 78% 90%,
    #e0f2f1 90% 100%);
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    overflow: hidden;
    cursor: crosshair;
    transition: all 0.2s ease;
}

.goods-line:hover {
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Book segments */
.book-segment {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2d3748;
    border-right: 2px solid rgba(160, 174, 192, 0.6);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.book-segment:hover {
    transform: scaleY(1.05);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.book-segment:last-child {
    border-right: none;
}

/* Markers container */
.markers-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    pointer-events: none;
}

/* Individual markers */
.marker {
    position: absolute;
    top: -10px;
    height: 100px;
    width: 3px;
    background-color: #e53e3e;
    border-radius: 2px;
    pointer-events: all;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.marker:hover {
    width: 4px;
    background-color: #c53030;
    transform: scaleY(1.05);
}

.marker.dragging {
    background-color: #2b6cb0;
    width: 4px;
    box-shadow: 0 4px 8px rgba(43, 108, 176, 0.4);
}

/* Player-specific marker colors */
.player1-marker { background-color: #e53e3e; }
.player2-marker { background-color: #38a169; }
.player3-marker { background-color: #3182ce; }

.marker-indicator {
    position: absolute;
    top: 10px;
    left: -5px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background-color: inherit;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.marker-label {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.marker:hover .marker-label {
    opacity: 1;
}

/* Marker controls */
.marker-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #f7fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

#current-player-info {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
}

#current-player-info span {
    color: #4a5568;
    font-weight: 500;
}

#current-player-info strong {
    color: #2d3748;
    font-weight: 600;
}

/* ===== RESULTS DISPLAY STYLES ===== */

.results-display {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.results-header h3,
.transfer-header h3 {
    color: #2d3748;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

.allocation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.allocation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f7fafc;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    border-left: 4px solid #3182ce;
    transition: all 0.2s ease;
}

.allocation-item:hover {
    background: #edf2f7;
    transform: translateX(4px);
}

.item-name,
.player-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.winner {
    color: #38a169;
    font-weight: 600;
    font-size: 0.9rem;
}

.winning-bid {
    background: #e6fffa;
    color: #234e52;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.segment-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
    color: #718096;
    font-weight: 500;
}

.utility-info {
    background: #e6fffa;
    color: #234e52;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Payment breakdown table */
.payment-breakdown {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    border: 1px solid #e2e8f0;
}

.payment-breakdown h4 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.payments-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.payments-breakdown-table th {
    background: #3182ce;
    color: white;
    padding: 0.75rem;
    font-weight: 600;
    text-align: left;
    font-size: 0.9rem;
}

.payments-breakdown-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    font-weight: 500;
}

.payments-breakdown-table tr:last-child td {
    border-bottom: none;
}

.payments-breakdown-table tr:nth-child(even) {
    background: #f7fafc;
}

.payments-breakdown-table .positive {
    color: #38a169;
    font-weight: 600;
}

.payments-breakdown-table .negative {
    color: #e53e3e;
    font-weight: 600;
}

/* ===== ANIMATION CLASSES ===== */

@keyframes fadeInInterface {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes highlightWinner {
    0%, 100% { background-color: transparent; }
    50% { background-color: #c6f6d5; }
}

@keyframes segmentHighlight {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.1); }
}

@keyframes markerPlacement {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(-10px);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auction-result-animation {
    animation: highlightWinner 1.5s ease-in-out;
}

.segment-allocation-animation {
    animation: segmentHighlight 2s ease-in-out;
}

.marker-placement-animation {
    animation: markerPlacement 0.5s ease-out;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .indivisible-goods-interface {
        padding: 1rem;
        margin: 1rem 0;
    }

    .items-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .player-bid {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .bid-input {
        width: 100%;
    }

    .linear-arrangement {
        padding: 1rem;
    }

    .goods-line {
        height: 60px;
    }

    .book-segment {
        font-size: 0.7rem;
    }

    .marker-controls {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    #current-player-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .payments-breakdown-table {
        font-size: 0.8rem;
    }

    .payments-breakdown-table th,
    .payments-breakdown-table td {
        padding: 0.5rem;
    }

    .allocation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        text-align: left;
    }

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

@media (max-width: 480px) {
    .marker-label {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    .book-segment {
        font-size: 0.6rem;
        padding: 0 0.2rem;
    }

    .bidding-header h3 {
        font-size: 1.25rem;
    }

    .marker-header h3 {
        font-size: 1.25rem;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */

@media (prefers-contrast: more) {
    .item-card {
        border-width: 3px;
    }

    .marker {
        width: 4px;
        border: 1px solid #000;
    }

    .goods-line {
        border-width: 3px;
    }

    .allocation-item {
        border-left-width: 6px;
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .indivisible-goods-interface {
        box-shadow: none;
        border: 1px solid #000;
    }

    .primary-btn {
        display: none;
    }

    .marker {
        background: #000 !important;
    }

    .goods-line {
        background: white;
        border: 2px solid #000;
    }
}