/* Shared Modal Styles matching the original Mastermind Aesthetic */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background-color: #d2d2dc;
    border: 0.15rem solid black;
    border-radius: 8px;
    width: 100%;
    max-width: 540px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-family: Arial, sans-serif;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.1rem solid black;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-title {
    margin: 0;
    font-size: 1.3rem;
    color: #111;
    font-weight: bold;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #333;
    line-height: 1;
    padding: 0 5px;
}

.modal-close-btn:hover {
    color: #000;
}

/* Statistics Modal Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.stat-box {
    background-color: #f0f0f5;
    border: 0.1rem solid black;
    border-radius: 4px;
    padding: 10px 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #000;
}

.stat-label {
    font-size: 0.75rem;
    color: #444;
    text-transform: uppercase;
    margin-top: 4px;
}

.distribution-section {
    margin-top: 15px;
    border-top: 0.1rem solid #aaa;
    padding-top: 15px;
}

.distribution-title {
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    color: #222;
}

.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.dist-num {
    width: 20px;
    text-align: right;
    font-weight: bold;
}

.dist-bar-container {
    flex: 1;
    background: #e0e0e8;
    border-radius: 3px;
    overflow: hidden;
    height: 18px;
}

.dist-bar {
    background-color: #388e3c;
    color: white;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 20px;
    box-sizing: border-box;
}

.dist-bar.zero {
    background-color: #9e9e9e;
}

.share-btn {
    background-color: #2e7d32;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    border: 0.1rem solid black;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.15s;
}

.share-btn:hover {
    background-color: #1b5e20;
}

/* ==========================================================================
   Archive Modal (Calendar View & List View)
   ========================================================================== */

.archive-view-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 0.1rem solid black;
    padding-bottom: 8px;
}

.archive-tab-btn {
    background-color: #f0f0f5;
    border: 0.1rem solid black;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    color: #222;
    transition: all 0.15s;
}

.archive-tab-btn.active {
    background-color: #2196F3;
    color: white;
    border-color: #0d47a1;
}

/* Calendar Navigation Header */
.calendar-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f0f0f5;
    border: 0.1rem solid black;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 10px;
    min-height: 44px;
    box-sizing: border-box;
}

.calendar-selectors-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.calendar-select {
    background-color: #ffffff;
    border: 0.1rem solid black;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #111;
    cursor: pointer;
    outline: none;
}

.calendar-select:focus {
    border-color: #2196F3;
}

.calendar-nav-btn {
    background-color: #fff;
    border: 0.1rem solid black;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 60px;
    text-align: center;
    user-select: none;
}

.calendar-nav-btn:hover:not(:disabled) {
    background-color: #e3f2fd;
    border-color: #1976d2;
}

.calendar-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Weekday column headers */
.calendar-weekdays-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: #444;
    margin-bottom: 6px;
}

/* Calendar Month Grid - Fixed 6 Rows (42 Cells) for Rock-Solid Stability */
.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 4px;
    min-height: 360px;
    box-sizing: border-box;
}

.calendar-day-cell {
    background-color: #f0f0f5;
    border: 0.1rem solid black;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 4px 2px;
    box-sizing: border-box;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
    user-select: none;
    min-height: 52px;
}

.calendar-day-cell:hover:not(.is-empty):not(.is-future) {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.calendar-day-cell.is-empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
    pointer-events: none;
}

.calendar-day-cell.is-future {
    background-color: #e0e0e8;
    color: #999;
    border-color: #bbb;
    cursor: not-allowed;
    opacity: 0.5;
}

.calendar-day-cell.is-today {
    border: 0.18rem solid #e65100;
    box-shadow: 0 0 0 1px #ff9800;
}

.cal-day-num {
    font-size: 0.85rem;
    font-weight: bold;
    line-height: 1;
}

.cal-puzzle-num {
    font-size: 0.65rem;
    color: #555;
    font-weight: bold;
    line-height: 1;
}

.cal-status-tag {
    font-size: 0.65rem;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
    margin-top: 1px;
}

/* Status colors in calendar */
.calendar-day-cell.status-won {
    background-color: #e8f5e9;
    border-color: #2e7d32;
    color: #1b5e20;
}

.calendar-day-cell.status-lost {
    background-color: #ffebee;
    border-color: #c62828;
    color: #b71c1c;
}

.calendar-day-cell.status-in-progress {
    background-color: #fff8e1;
    border-color: #f57f17;
    color: #e65100;
}

.calendar-day-cell.status-unplayed {
    background-color: #ffffff;
    border-color: #777;
}

/* Archive List View */
.archive-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.archive-filter-btn {
    background-color: #f0f0f5;
    border: 0.1rem solid black;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

.archive-filter-btn.active {
    background-color: #2196F3;
    color: white;
    font-weight: bold;
}

.archive-search-input {
    padding: 5px 10px;
    border: 0.1rem solid black;
    border-radius: 4px;
    font-size: 0.85rem;
    flex: 1;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 52vh;
    overflow-y: auto;
    padding-right: 5px;
}

.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f0f0f5;
    border: 0.1rem solid black;
    border-radius: 6px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
}

.archive-item:hover {
    background-color: #ffffff;
    border-color: #2196F3;
    transform: translateX(2px);
}

.archive-item.today {
    border: 0.15rem solid #ff9800;
}

.archive-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.archive-puzzle-num {
    font-weight: bold;
    font-size: 0.95rem;
}

.archive-date {
    font-size: 0.8rem;
    color: #666;
}

.archive-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 0.1rem solid transparent;
}

.badge-won {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.badge-lost {
    background-color: #ffebee;
    color: #c62828;
    border-color: #ef9a9a;
}

.badge-in-progress {
    background-color: #fff8e1;
    color: #f57f17;
    border-color: #ffe082;
}

.badge-unplayed {
    background-color: #e0e0e0;
    color: #616161;
    border-color: #bdbdbd;
}

/* ==========================================================================
   Header Navigation Bar (Connected seamlessly without gaps)
   ========================================================================== */
.mode-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: rgb(210, 210, 220);
    border: 0.1rem solid black;
    border-bottom: none;
    margin: 0 auto;
    max-width: 1600px;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-title {
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: bold;
    color: #111;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-action-btn {
    background-color: #ffffff;
    border: 0.1rem solid black;
    padding: 5px 10px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    color: #000;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.15s;
}

.nav-action-btn:hover {
    background-color: #e3f2fd;
    border-color: #1976d2;
}
