/* Blackjack AI Strategy Assistant Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #ffffff 0%, #f3f6ff 50%, #eef4ff 100%);
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
    background: linear-gradient(135deg, #f8fbff 0%, #f0f6ff 100%);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
}

header h1 {
    font-size: 1.6rem;
    margin-bottom: 5px;
    text-shadow: none;
    color: #2c3e50;
}

header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* Right column container */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

section {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(44, 62, 80, 0.08);
    backdrop-filter: blur(10px);
}

section h2, section h3 {
    margin-bottom: 8px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 4px;
    font-size: 1rem;
}

/* Card Input Section */
.card-input-section {
    grid-column: 1;
    background: linear-gradient(to bottom right, #ffffff, #f0f7ff);
    border-left: 5px solid #3498db;
}

.player-cards, .dealer-card {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(52, 152, 219, 0.1);
}

.player-cards h3, .dealer-card h3 {
    margin-bottom: 8px;
    color: #34495e;
    font-size: 1rem;
    border: none;
    padding-bottom: 3px;
}

.card-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.card-slot {
    width: 100px;
    height: 65px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-size: 0.9rem;
}

.card-slot:hover {
    border-color: #3498db;
    background: #e3f2fd;
    transform: translateY(-2px);
}

.card-slot.active {
    border-color: #e74c3c;
    background: #ffebee;
    animation: pulse 1s infinite;
}

.card-slot.filled {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
    font-weight: bold;
    border-style: solid;
}

.card-slot .card-value {
    font-size: 1.5rem;
    font-weight: bold;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card-slot.extra-card {
    background: #3498db;
    border-color: #3498db;
    color: white;
    font-weight: bold;
    border-style: solid;
}

.hand-value {
    font-size: 0.95rem;
    color: #2c3e50;
    margin-top: 6px;
}

/* Card Grid */
.card-grid {
    display: none;
    grid-template-columns: repeat(13, 1fr);
    gap: 5px;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.card-grid.visible {
    display: grid;
}

.card-option {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.card-option:hover {
    border-color: #3498db;
    background: #e3f2fd;
    transform: scale(1.1);
}

.card-option[data-value="A"] {
    background: #e74c3c;
    color: white;
    border-color: #c0392b;
}

.card-option[data-value="10"],
.card-option[data-value="J"],
.card-option[data-value="Q"],
.card-option[data-value="K"] {
    background: #34495e;
    color: white;
    border-color: #2c3e50;
}

/* Decision Button */
.decision-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(45deg, #3498db, #2ecc71);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.decision-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.decision-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* Decision Section */
.decision-section {
    grid-column: 2;
    background: linear-gradient(to bottom right, #ffffff, #fff9f0);
    border-left: 5px solid #f39c12;
}

.recommendation-panel {
    margin-bottom: 8px;
    text-align: center;
}

.main-decision {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.decision-action {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.decision-action.hit {
    color: #e74c3c;
}

.decision-action.stand {
    color: #27ae60;
}

.decision-action.double {
    color: #f39c12;
}

.decision-action.split {
    color: #9b59b6;
}

.confidence-score {
    font-size: 0.95rem;
    color: #7f8c8d;
}

.confidence-score.visible {
    display: block;
}

/* Outcome Buttons */
.outcome-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.outcome-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.win-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.loss-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.push-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.bust-btn {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

/* Probability Panel */
.probability-panel {
    margin-bottom: 8px;
}

.prob-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.prob-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 6px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    font-size: 0.85rem;
}

.prob-item label {
    font-weight: 600;
    color: #2c3e50;
}

.prob-item span {
    font-weight: bold;
    color: #27ae60;
}

/* Explanation Panel */
.explanation-panel {
    background: linear-gradient(to bottom right, #ffffff, #fffdf0);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(44, 62, 80, 0.08);
    border-left: 5px solid #f1c40f;
}

.explanation-panel h3 {
    color: #2c3e50;
    margin-bottom: 6px;
    border: none;
    font-size: 0.95rem;
    border-bottom: 1px solid #fef9e7;
    padding-bottom: 4px;
}

.explanation-panel p {
    color: #34495e;
    line-height: 1.4;
    font-size: 0.85rem;
}

/* Algorithm Votes */
.algorithm-votes {
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: linear-gradient(to bottom right, #ffffff, #f8fafc);
    border-radius: 8px;
    border: 1px solid rgba(44, 62, 80, 0.08);
    border-left: 5px solid #64748b;
}

.algorithm-votes h4 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 0.95rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
}

.votes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.vote-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: white;
    border-radius: 5px;
    font-size: 0.85rem;
}

.vote-item .algorithm {
    color: #7f8c8d;
}

.vote-item .vote {
    font-weight: bold;
}

.vote.hit { color: #e74c3c; }
.vote.stand { color: #27ae60; }
.vote.double { color: #f39c12; }
.vote.split { color: #9b59b6; }
.vote.neutral { color: #7f8c8d; }

/* Settings Section */
.settings-section {
    grid-column: span 2;
    margin-top: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 600;
    color: #2c3e50;
}

.setting-item select {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.setting-item select:focus {
    outline: none;
    border-color: #3498db;
}

/* Performance Section */
.performance-section {
    grid-column: span 2;
    background: linear-gradient(to right, #ffffff, #f0fff4);
    border-top: 5px solid #2ecc71;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Session statistics - force single line */
.performance-section .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    border-left: 4px solid #3498db;
}

.stat-item label {
    display: block;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 3px;
    font-size: 0.75rem;
}

.stat-item span {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

.reset-btn {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    color: white;
}

.loading.visible {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #3498db;
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.2rem;
    text-align: center;
}

/* Error Toast */
.error-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #e74c3c;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */

/* Keep two-column layout on tablets for better space usage */
@media (max-width: 1024px) {
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    main {
        gap: 10px;
    }
    
    section {
        padding: 10px;
    }
    
    header {
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    
    header h1 {
        font-size: 1.4rem;
    }
    
    header p {
        font-size: 0.85rem;
    }
}

/* iPad portrait and small tablets (768px and below) - Still keep 2 columns */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    main {
        gap: 8px;
    }
    
    section {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .card-slot {
        width: 85px;
        height: 55px;
        font-size: 0.85rem;
    }
    
    .decision-action {
        font-size: 1.3rem;
    }
    
    .card-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
        padding: 8px;
    }
}

/* Large mobile devices (600px and below) - Switch to single column */
@media (max-width: 600px) {
    main {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .decision-section,
    .settings-section,
    .performance-section {
        grid-column: 1;
    }
    
    .card-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
    }
    
    .card-slot {
        width: 75px;
        height: 50px;
        font-size: 0.8rem;
    }
}

/* Dark mode support intentionally disabled (always use light theme). */

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .loading,
    .card-grid,
    .decision-btn,
    .reset-btn {
        display: none !important;
    }
    
    section {
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 20px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .card-slot {
        border-width: 4px;
    }
    
    .decision-action {
        text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    }
    
    .prob-item {
        border-left-width: 5px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card-slot:hover,
    .card-option:hover,
    .decision-btn:hover {
        transform: none;
    }
}
/* Composition/Shoe Info Section */
.shoe-info-section {
    background: linear-gradient(145deg, #fffdfa, #f0e8ff);
    padding: 10px;
    border-radius: 10px;
    color: #0e0e0e;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(44, 62, 80, 0.08);
    border-left: 5px solid #9b59b6;
    margin-bottom: 0;
}

.shoe-info-section h3 {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #0e0e0e;
    border-bottom: 2px solid #9b59b6;
}

.shoe-info-section .stats-grid {
    background: rgba(155, 89, 182, 0.05);
    padding: 8px;
    border-radius: 8px;
}

.shoe-info-section .stat-item {
    padding: 3px 0;
}

.shoe-info-section .stat-item label {
    color: #0e0e0e;
    font-size: 0.7rem;
}

.shoe-info-section .stat-item span {
    color: #0b0b0b;
    font-weight: bold;
    font-size: 0.85rem;
}

.shoe-meta {
    margin-top: 12px;
    font-size: 0.9em;
    color: #111111;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shoe-meta p {
    margin: 0;
}

.shoe-meta .divider {
    margin: 0 10px;
    color: rgba(11, 11, 11, 0.6);
}

#comp-advantage {
    color: #16a085;
}

#composition-mode {
    margin-right: 8px;
    transform: scale(1.2);
    cursor: pointer;
}

#reset-shoe-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#reset-shoe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#reset-shoe-btn:active {
    transform: translateY(0);
}

/* Save Confirmation Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(to bottom right, #ffffff, #f8fbff);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3rem;
    text-align: center;
}

.card-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.preview-section {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(52, 152, 219, 0.1);
}

.preview-section h4 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 0.95rem;
}

.preview-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.preview-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.preview-total {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: 0;
}

.outcome-display {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    padding: 15px;
    border-radius: 8px;
    border-left: 5px solid #27ae60;
    margin-bottom: 20px;
    text-align: center;
}

.outcome-display p {
    margin: 0;
    color: #2c3e50;
}

.outcome-display span {
    font-size: 1.3em;
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.cancel-btn {
    background: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
}

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