/**
 * Koi Auction Frontend Styles
 * Mobile-First Design
 */

/* ===================================
   Variables
   =================================== */
:root {
    --primary-color: #c41e3a;
    --secondary-color: #1a1a1a;
    --accent-color: #ffd700;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===================================
   Single Auction View
   =================================== */
.koi-auction-single {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.auction-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.auction-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.auction-image img {
    width: 100%;
    height: auto;
    display: block;
}

.auction-info {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auction-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.variety-badge, .status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.variety-badge {
    background: var(--accent-color);
    color: var(--secondary-color);
}

.status-badge {
    background: var(--light-gray);
    color: var(--text-color);
}

.status-badge.status-active {
    background: var(--success-color);
    color: #fff;
}

.status-badge.status-sold {
    background: var(--primary-color);
    color: #fff;
}

.auction-price-info {
    margin-bottom: 25px;
}

.auction-price-info > div {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.auction-price-info > div:last-child {
    border-bottom: none;
}

.auction-price-info .label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.auction-price-info .price {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Timer */
.auction-timer {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
}

.timer-label {
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 600;
}

.timer-display {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.timer-display > span {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-display .number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.timer-display .label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.auction-ended {
    background: var(--danger-color);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

/* Bid Form */
.bid-form-container {
    margin-bottom: 25px;
}

.koi-bid-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bid-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.bid-amount-input {
    width: 100%;
    padding: 15px 40px 15px 15px;
    font-size: 18px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.bid-amount-input:focus {
    border-color: var(--primary-color);
}

.bid-input-group .currency {
    position: absolute;
    right: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #666;
}

.btn-place-bid, .btn-buy-now {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-place-bid {
    background: var(--primary-color);
    color: #fff;
}

.btn-place-bid:hover {
    background: #a01629;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.btn-buy-now {
    background: var(--accent-color);
    color: var(--secondary-color);
}

.btn-buy-now:hover {
    background: #e6c200;
    transform: translateY(-2px);
}

.btn-place-bid:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.bid-message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.bid-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.bid-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Login Required */
.login-required {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.btn-login {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-login:hover {
    background: #a01629;
    transform: translateY(-2px);
}

/* Auction Stats */
.auction-stats {
    display: flex;
    gap: 20px;
    padding: 20px 0;
}

.auction-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.auction-stats .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.auction-stats .label {
    font-size: 14px;
    color: #666;
}

/* Koi Details */
.koi-details {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.koi-details h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.details-table {
    width: 100%;
    border-collapse: collapse;
}

.details-table tr {
    border-bottom: 1px solid var(--border-color);
}

.details-table th {
    text-align: left;
    padding: 12px 0;
    font-weight: 600;
    width: 40%;
}

.details-table td {
    padding: 12px 0;
}

/* Bid History */
.bid-history {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.bid-history h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.bids-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bid-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s;
}

.bid-item:hover {
    background: var(--light-gray);
}

.bid-item.winning-bid {
    background: #fff3cd;
    border-left: 4px solid var(--accent-color);
}

.bidder-name {
    font-weight: 600;
    flex: 1;
}

.bid-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 20px;
}

.bid-time {
    font-size: 14px;
    color: #666;
}

.no-bids {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ===================================
   Auctions Grid
   =================================== */
.koi-auctions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin: 30px 0;
}

.auction-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.auction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image .variety-badge {
    position: absolute;
    top: 10px;
    left: 10px;
}

.card-image .status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

.card-content {
    padding: 20px;
}

.card-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--secondary-color);
}

.card-price {
    margin-bottom: 10px;
}

.card-price .label {
    font-size: 14px;
    color: #666;
}

.card-price .price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.card-timer, .card-ended {
    font-size: 14px;
    padding: 8px 0;
    color: #666;
}

.card-stats {
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: #666;
}

/* ===================================
   My Bids
   =================================== */
.my-bids-list {
    margin: 30px 0;
}

.bids-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: var(--shadow);
}

.bids-table thead {
    background: var(--light-gray);
}

.bids-table th, .bids-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.bids-table tr.winning {
    background: #d4edda;
}

.bids-table tr.outbid {
    background: #f8d7da;
}

.status-winning {
    color: var(--success-color);
    font-weight: 600;
}

.status-outbid {
    color: var(--danger-color);
    font-weight: 600;
}

.btn-view {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.btn-view:hover {
    background: #a01629;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablets */
@media (min-width: 768px) {
    .auction-header {
        grid-template-columns: 1fr 1fr;
    }
    
    .koi-auctions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .koi-bid-form {
        flex-direction: row;
        align-items: center;
    }
    
    .bid-input-group {
        flex: 1;
    }
    
    .btn-place-bid, .btn-buy-now {
        flex-shrink: 0;
        min-width: 150px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .koi-auctions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .auction-header {
        grid-template-columns: 1.5fr 1fr;
    }
    
    .bid-item {
        flex-wrap: nowrap;
    }
}

@media (min-width: 1200px) {
    .koi-auctions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile optimizations */
@media (max-width: 767px) {
    .auction-price-info .price {
        font-size: 24px;
    }
    
    .timer-display .number {
        font-size: 24px;
    }
    
    .bid-amount-input {
        font-size: 16px;
    }
    
    .btn-place-bid, .btn-buy-now {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .bid-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .bid-amount {
        margin: 0;
    }
    
    .bids-table {
        font-size: 14px;
    }
    
    .bids-table th, .bids-table td {
        padding: 10px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
button:focus, input:focus, a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

