/* Auctionauts - Mobile-First Responsive CSS */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header-status {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

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

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Auction Cards */
.auction-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--primary);
}

.auction-card.winning {
    border-left-color: var(--success);
}

.auction-card.outbid {
    border-left-color: var(--danger);
}

.auction-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.auction-player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.auction-player {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.auction-details {
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.auction-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.auction-bid-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.current-bid {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-800);
}

.bid-winner {
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.timer {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.timer.urgent {
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Bid Form */
.bid-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bid-form .bid-input {
    width: 140px;
    padding: 0.375rem 0.5rem;
    height: auto;
}

.bid-form .btn-compact {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Player List */
.player-list {
    list-style: none;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.player-item:last-child {
    border-bottom: none;
}

.player-name {
    font-weight: 500;
}

.player-info {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Manager List */
.manager-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.manager-status {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.manager-status.online {
    background: var(--success);
}

.manager-status.offline {
    background: var(--gray-300);
}

/* Budget Display */
.budget-display {
    background: var(--gray-50);
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.budget-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.budget-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.budget-value {
    font-weight: 600;
}

.budget-value.available {
    color: var(--success);
    font-size: 1.25rem;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Lobby */
.lobby-status {
    text-align: center;
    padding: 2rem;
}

.lobby-status h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.manager-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-100);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.manager-badge.connected {
    background: #dcfce7;
    color: var(--success);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    max-width: 90vw;
    width: 320px;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 1rem;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.outbid {
    border-left: 4px solid var(--danger);
}

.notification.won {
    border-left: 4px solid var(--success);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th, td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
}

/* Admin Panel */
.admin-section {
    margin-bottom: 2rem;
}

.admin-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.token-link {
    font-family: monospace;
    font-size: 0.75rem;
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    word-break: break-all;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* Responsive Navigation */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.nav-tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
}

.nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Status Badge */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.badge-info {
    background: #dbeafe;
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Position badges for player pool */
.pos-badge-qb {
    background: #f43f5e;
    color: #ffffff;
}

.pos-badge-rb {
    background: #2dd4bf;
    color: #ffffff;
}

.pos-badge-wr {
    background: #3b82f6;
    color: #ffffff;
}

.pos-badge-te {
    background: #f97316;
    color: #ffffff;
}

.pos-badge-pick {
    background: #8b5cf6;
    color: #ffffff;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .header h1 {
        font-size: 1rem;
    }

    .auction-details {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bid-form {
        flex-direction: column;
    }

    .bid-form button {
        width: 100%;
    }

    /* Tables: horizontal scroll wrapper */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Modals: full-width on mobile */
    #trade-modal > div,
    #sale-modal > div {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
        max-height: 100vh;
        overflow-y: auto;
    }

    /* All Drafts card layout on mobile */
    .drafts-table-desktop {
        display: none;
    }

    .drafts-cards-mobile {
        display: block;
    }

}

@media (min-width: 641px) {
    .drafts-cards-mobile {
        display: none;
    }
}

/* Manager Summary Grid (Draft Summary) */
.manager-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.manager-summary-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: all 0.2s;
}

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

.manager-summary-card.current-manager {
    background: #dbeafe;
    border-color: var(--primary);
    border-width: 2px;
}

.manager-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-300);
}

.manager-summary-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.manager-summary-stats {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.125rem;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
}

.stat-danger {
    color: var(--danger);
}

.stat-success {
    color: var(--success);
}

.stat-warning {
    color: var(--warning);
}

.manager-summary-players {
    min-height: 2.5rem;
}

.player-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.player-chip {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    font-size: 0.65rem;
    color: var(--gray-700);
    white-space: nowrap;
}

.player-chip-won {
    background: #dcfce7;
    border-color: var(--success);
    color: #166534;
}

.player-chip-winning {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

/* Responsive adjustments for manager summary */
@media (max-width: 640px) {
    .manager-summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 640px) and (max-width: 1024px) {
    .manager-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .manager-summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Nomination pool checkbox styling */
.nomination-pool-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.nomination-pool-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Token Display */
.token-display {
    display: flex;
    gap: 0.5rem;
}

.token-display .form-input {
    flex: 1;
    font-family: monospace;
    font-size: 0.875rem;
}

/* Landing Page Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 3em;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.3em;
    max-width: 600px;
    margin: 0 auto 30px;
    opacity: 0.95;
}

.hero .btn {
    font-size: 1.1em;
    padding: 15px 40px;
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Landing Page Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.feature-card {
    background: var(--gray-50);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.feature-card h3 {
    margin-bottom: 15px;
    color: var(--primary);
}

/* Landing Page Footer */
.landing-footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--gray-200);
    margin-top: 60px;
}

.footer-tip {
    margin-top: 20px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: 8px;
    display: inline-block;
}

/* Join Draft Collapsible */
.join-section {
    margin-top: 2rem;
    text-align: center;
}

.join-section summary {
    cursor: pointer;
    color: var(--gray-500);
    font-size: 0.875rem;
    list-style: none;
}

.join-section summary::-webkit-details-marker {
    display: none;
}

.join-section[open] summary {
    margin-bottom: 1rem;
}

.join-form {
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
}

@media (max-width: 640px) {
    .hero h1 {
        font-size: 1.8em;
    }

    .hero p {
        font-size: 1.1em;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .hero .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Nomination Turn Indicator */
.nomination-banner {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    animation: nomination-pulse 2s ease-in-out infinite;
}

.nomination-banner h3 {
    font-size: 1.25rem;
}

@keyframes nomination-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

/* Super Admin */
.super-admin-badge {
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.filter-controls {
    display: flex;
    gap: 16px;
    padding: 20px;
    align-items: center;
}

.filter-controls select,
.filter-controls input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

@media (max-width: 640px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

.draft-row:hover {
    background: var(--gray-50);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.status-lobby { background: #ffc107; color: #000; }
.status-active { background: #28a745; color: #fff; }
.status-paused { background: #17a2b8; color: #fff; }
.status-complete { background: #6c757d; color: #fff; }

/* Bid History */
.bid-history-table {
    width: 100%;
    border-collapse: collapse;
}

.bid-history-table th {
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #333;
}

.bid-history-table th.text-right {
    text-align: right;
}

.bid-history-table th.text-center {
    text-align: center;
}

.bid-row td {
    padding: 10px;
    border-bottom: 1px solid #444;
}

.bid-row--own {
    background-color: rgba(0, 123, 255, 0.1);
}

.bid-row--own .bid-manager {
    font-weight: bold;
}

/* Text utilities */
.text-lg {
    font-size: 1.125rem;
}

/* Sale auction card: prevent timer from overlapping details on mobile */
@media (max-width: 640px) {
    #sale-auctions-container .auction-player-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    #sale-auctions-container .auction-details {
        white-space: normal;
    }
}
