/* =============================================================================
   WAP CSS — Mobile-first lottery betting UI
   Design follows NewWAP Meteor reference: minimalist, black-on-white, boxed menus
   ============================================================================= */

/* --- Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #000;
    background: #fff;
    -webkit-text-size-adjust: 100%;
}

a {
    color: #000;
    text-decoration: none;
}

/* --- Container --- */
.wap-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0.5rem;
}

/* --- Running Text --- */
.running-text {
    background: #f5f5f5;
    padding: 0.25rem 0;
    font-size: 12px;
    border: 0.1rem solid #000;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

/* --- User Info Header --- */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border: 0.1rem solid #000;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.user-info .username {
    font-size: 13px;
}

.user-info .balance {
    font-size: 13px;
    color: #007bff;
}

/* --- Main Menu (Dashboard) --- */
.main-menu > a,
.main-menu > div {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 0.1rem solid #000;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.main-menu > a:hover,
.main-menu > a:active {
    background: #f0f0f0;
}

/* --- Page Header / Back Link --- */
.page-header {
    margin-bottom: 0.5rem;
}

.page-header h3 {
    font-size: 16px;
    font-weight: bold;
    margin: 0.25rem 0;
}

.back-link {
    font-size: 13px;
    color: #666;
    display: inline-block;
    margin-bottom: 0.25rem;
}

.back-link:hover {
    color: #000;
}

/* --- Tab Navigation (Normal/Full market types) --- */
.tab-nav {
    display: flex;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #000;
}

.tab-nav a {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0;
    font-weight: bold;
    font-size: 13px;
    border: 0.1rem solid #000;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-right: 2px;
    background: #f5f5f5;
}

.tab-nav a:last-child {
    margin-right: 0;
}

.tab-nav a.active {
    background: #fff;
    border-bottom: 2px solid #fff;
    margin-bottom: -2px;
}

/* --- Market List Items --- */
.market-item {
    display: block;
    padding: 0.5rem;
    border: 0.1rem solid #000;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
}

.market-item:hover {
    background: #f0f0f0;
}

.market-item .market-name {
    font-weight: bold;
    font-size: 14px;
}

.market-item .market-schedule {
    font-size: 11px;
    color: #666;
}

.market-item .market-time {
    font-size: 11px;
    color: #333;
}

.market-item .favorite-badge {
    display: inline-block;
    background: #ff4444;
    color: #fff;
    font-size: 10px;
    padding: 0 4px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Result Table --- */
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.result-table th,
.result-table td {
    padding: 0.35rem;
    border: 0.1rem solid #000;
    text-align: left;
}

.result-table th {
    background: #f5f5f5;
    font-weight: bold;
}

/* --- Result Balls (individual digits) --- */
.result-digits {
    display: inline-flex;
    gap: 2px;
}

.result-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #000;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    background: #fff;
}

/* --- Market Type Badge --- */
.market-type-badge {
    display: inline-block;
    font-size: 10px;
    padding: 0 4px;
    border: 1px solid #999;
    border-radius: 3px;
    color: #666;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0.1rem solid #000;
    border-radius: 0.25rem;
    font-weight: bold;
    font-size: 14px;
}

.pagination .page-link:hover {
    background: #f0f0f0;
}

.pagination .page-info {
    font-size: 12px;
    color: #666;
}

/* --- Forms --- */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.form-group label {
    font-size: 13px;
    margin-bottom: 0.25rem;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.4rem;
    border: 0.1rem solid #000;
    border-radius: 0.25rem;
    font-size: 14px;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid #007bff;
}

/* --- Buttons --- */
.btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 0.1rem solid #000;
    border-radius: 0.5rem;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    background: #fff;
    transition: background 0.15s;
}

.btn:hover {
    background: #f0f0f0;
}

.btn-primary {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* --- Messages (Chat Style) --- */
.message-list {
    margin-bottom: 0.5rem;
}

.message-bubble {
    padding: 0.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    max-width: 70%;
    font-size: 13px;
}

.message-bubble.user {
    float: right;
    background: #d3d3d3;
    clear: both;
}

.message-bubble.system {
    float: left;
    background: #90ee90;
    clear: both;
}

.message-bubble .timestamp {
    font-size: 10px;
    color: #666;
    display: block;
    margin-top: 0.15rem;
}

.message-input {
    display: flex;
    gap: 0.25rem;
}

.message-input input {
    flex: 1;
    padding: 0.4rem;
    border: 0.1rem solid #000;
    border-radius: 0.25rem;
    font-size: 14px;
}

.message-input button {
    padding: 0.4rem 0.75rem;
    border: 0.1rem solid #000;
    border-radius: 0.25rem;
    font-weight: bold;
    cursor: pointer;
    background: #fff;
}

/* --- Alerts --- */
.alert {
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 13px;
}

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

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

/* --- Logo --- */
.logo-container {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.logo-container img {
    width: 15rem;
    max-width: 100%;
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #666; }
.text-small { font-size: 11px; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.clearfix::after { content: ""; display: table; clear: both; }

/* --- Error Pages --- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 1rem;
}

.error-page h1 {
    font-size: 48px;
    margin-bottom: 0.5rem;
}

.error-page p {
    font-size: 14px;
    color: #666;
    margin-bottom: 1rem;
}
