/* Public styles - minimal to avoid conflicts with theme */
.accwc-container {
    /* Let theme handle container width and margins */
    /* Only add minimal padding if needed */
    padding: 10px 0;
}

.accwc-header {
    margin-bottom: 20px;
}

.accwc-header h1 {
    /* Use theme's h1 styling */
    margin-bottom: 10px;
}

.accwc-nav {
    margin-top: 10px;
}

.accwc-nav .btn {
    margin-right: 10px;
    /* Use theme's button/link styling where possible */
    text-decoration: none;
}

.accwc-season-nav {
    margin: 20px 0;
    padding: 10px;
    /* Use theme's background if available, otherwise light gray */
    background-color: #f0f0f0;
}

.accwc-season-nav a {
    margin-right: 10px;
    text-decoration: none;
    color: #0073aa;
}

.accwc-season-nav a:hover {
    text-decoration: underline;
}

.accwc-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px;
    margin: 20px 0;
    border-radius: 3px;
}

.accwc-warning ul {
    margin: 10px 0;
    padding-left: 20px;
}

.accwc-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    margin: 20px 0;
    border-radius: 3px;
}

.accwc-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    margin: 20px 0;
    border-radius: 3px;
}

.accwc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    /* Use theme's table styling where possible */
}

.accwc-table th,
.accwc-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.accwc-table th {
    /* Use theme's table header styling if available */
    background-color: #343a40;
    color: white;
    font-weight: bold;
}

.accwc-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.accwc-table .text-center {
    text-align: center;
}

.accwc-form {
    margin: 20px 0;
}

.accwc-form table {
    width: 100%;
}

.accwc-form input[type="text"],
.accwc-form input[type="password"],
.accwc-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.accwc-form .btn {
    padding: 10px 20px;
    /* Use theme's button styling where possible */
    cursor: pointer;
}

.accwc-table tr.checked {
    background-color: gold !important;
}

.td-clickable {
    cursor: pointer;
}

/* Use theme's button classes where possible */
.btn {
    display: inline-block;
    padding: 8px 16px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #0073aa;
    border-radius: 3px;
    background-color: #0073aa;
    color: #ffffff;
    font-weight: normal;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn:hover {
    background-color: #005a87;
    border-color: #005a87;
    color: #ffffff;
    text-decoration: none;
}

.btn-primary {
    background-color: #0073aa;
    border-color: #0073aa;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #005a87;
    border-color: #005a87;
    color: #ffffff;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: #ffffff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Base mobile styles - apply to screens smaller than 768px */
@media screen and (max-width: 767px) {
    /* Container adjustments */
    .accwc-container {
        padding: 5px;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
        /* Ensure sticky works - don't set overflow-y on container */
        position: relative;
    }
    
    /* Prevent horizontal scrolling */
    body.accwc-page {
        overflow-x: hidden;
        max-width: 100vw;
        position: relative;
    }
    
    body.accwc-page * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure form container doesn't break sticky */
    #accwc-votes-form {
        position: relative;
    }
    
    /* Fix for iOS Safari sticky - ensure parent has proper context */
    .accwc-container > * {
        position: relative;
    }
    
    /* Header adjustments */
    .accwc-header h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
        word-wrap: break-word;
    }
    
    /* Navigation - stack buttons vertically on mobile */
    .accwc-nav {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .accwc-nav .btn {
        display: block;
        width: 100%;
        margin: 0 0 8px 0;
        padding: 12px 16px;
        text-align: center;
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 44px; /* Touch-friendly */
        box-sizing: border-box;
    }
    
    /* Season navigation - wrap on mobile */
    .accwc-season-nav {
        padding: 12px 8px;
        font-size: 16px;
        word-wrap: break-word;
    }
    
    .accwc-season-nav a {
        display: inline-block;
        margin: 6px 10px 6px 0;
        padding: 8px 12px;
        font-size: 16px;
    }
    
    /* Warning boxes */
    .accwc-warning,
    .accwc-error,
    .accwc-success {
        padding: 15px;
        margin: 15px 0;
        font-size: 16px;
        line-height: 1.5;
    }
    
    .accwc-warning h3,
    .accwc-warning h4,
    .accwc-warning h5 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .accwc-warning ul {
        padding-left: 25px;
        margin: 10px 0;
        font-size: 15px;
    }
    
    .accwc-warning li {
        margin-bottom: 8px;
        line-height: 1.5;
    }
    
    /* Tables - convert to cards on mobile (except voting table) */
    .accwc-table:not(#tbl-votes) {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .accwc-table:not(#tbl-votes) thead {
        display: none; /* Hide table header on mobile */
    }
    
    .accwc-table:not(#tbl-votes) tbody {
        display: block;
    }
    
    .accwc-table:not(#tbl-votes) tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .accwc-table:not(#tbl-votes) td {
        display: block;
        padding: 12px;
        border: none;
        border-bottom: 1px solid #eee;
        text-align: left !important;
        position: relative;
        padding-left: 40%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 15px;
        line-height: 1.5;
    }
    
    .accwc-table:not(#tbl-votes) td:last-child {
        border-bottom: none;
    }
    
    .accwc-table:not(#tbl-votes) td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 35%;
        font-weight: bold;
        color: #333;
        font-size: 15px;
    }
    
    /* For home page table - add data labels (only for non-votes tables) */
    .accwc-table:not(#tbl-votes) td:first-child:before { content: "#"; }
    .accwc-table:not(#tbl-votes) td:nth-child(2):before { content: "Host"; }
    .accwc-table:not(#tbl-votes) td:nth-child(3):before { content: "Word"; }
    .accwc-table:not(#tbl-votes) td:nth-child(4):before { content: "Status"; }
    .accwc-table:not(#tbl-votes) td:nth-child(5):before { content: "Cluers"; }
    .accwc-table:not(#tbl-votes) td:nth-child(6):before { content: "Voters"; }
    .accwc-table:not(#tbl-votes) td:nth-child(7):before { content: "Comments"; }
    .accwc-table:not(#tbl-votes) td:nth-child(8):before { content: "Start Date"; }
    .accwc-table:not(#tbl-votes) td:nth-child(9):before { content: "Vote Start"; }
    .accwc-table:not(#tbl-votes) td:nth-child(10):before { content: "Vote End"; }
    .accwc-table:not(#tbl-votes) td:nth-child(11):before { content: "Host Page"; }
    
    /* Forms - full width inputs on mobile */
    .accwc-form {
        margin: 15px 0;
    }
    
    .accwc-form table {
        width: 100%;
        display: block;
    }
    
    .accwc-form table tr {
        display: block;
        margin-bottom: 15px;
    }
    
    .accwc-form table td {
        display: block;
        width: 100% !important;
        padding: 5px 0;
    }
    
    .accwc-form input[type="text"],
    .accwc-form input[type="password"],
    .accwc-form textarea {
        width: 100%;
        padding: 14px;
        font-size: 18px; /* Prevent zoom on iOS, larger for readability */
        box-sizing: border-box;
        min-height: 50px; /* Touch-friendly */
    }
    
    .accwc-form textarea {
        min-height: 120px;
        resize: vertical;
        font-size: 18px;
        line-height: 1.5;
    }
    
    /* Buttons - full width and touch-friendly */
    .btn {
        display: block;
        width: 100%;
        padding: 14px 18px;
        margin: 10px 0;
        font-size: 18px;
        min-height: 50px;
        box-sizing: border-box;
        text-align: center;
        font-weight: 500;
    }
    
    .btn-sm {
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .btn-lg {
        padding: 16px 24px;
        font-size: 20px;
        min-height: 54px;
        font-weight: 600;
    }
    
    /* Voting page specific */
    #vote-counter-bar {
        padding: 12px 10px;
        font-size: 16px;
        position: -webkit-sticky !important; /* Safari - important for iOS */
        position: sticky !important;
        top: 0 !important;
        z-index: 9999 !important;
        box-sizing: border-box;
        width: 100%;
        margin: 8px 0;
        will-change: transform; /* Optimize for mobile */
        -webkit-backface-visibility: hidden; /* Fix iOS rendering */
        backface-visibility: hidden;
        transform: translateZ(0); /* Force hardware acceleration */
        -webkit-transform: translateZ(0);
    }
    
    #vote-counter-bar span {
        display: inline-block;
        margin: 0 10px 0 0;
        white-space: nowrap;
    }
    
    #vote-counter-bar span:last-child {
        margin-right: 0;
    }
    
    #vote-counter-bar #points-value,
    #vote-counter-bar #clues-value {
        font-weight: bold;
        font-size: 20px;
    }
    
    /* Voting table - special handling - keep as table on mobile */
    #tbl-votes {
        display: table !important;
        width: 100% !important;
        font-size: 15px;
        table-layout: fixed !important;
        word-wrap: break-word;
        border-collapse: collapse;
        border-spacing: 0;
    }
    
    #tbl-votes thead {
        display: table-header-group !important;
    }
    
    #tbl-votes thead th {
        padding: 10px 5px !important;
        font-size: 14px;
        font-weight: bold;
        word-wrap: break-word;
    }
    
    #tbl-votes tbody {
        display: table-row-group !important;
    }
    
    #tbl-votes tr {
        display: table-row !important;
        margin-bottom: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    
    #tbl-votes td {
        display: table-cell !important;
        padding: 10px 5px !important;
        border: 1px solid #ddd !important;
        text-align: left !important;
        position: static !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto;
        vertical-align: top;
        font-size: 15px;
        line-height: 1.4;
    }
    
    #tbl-votes td:before {
        display: none !important;
    }
    
    #tbl-votes .row-number {
        width: 35px !important;
        min-width: 35px;
        max-width: 35px;
        text-align: center;
        font-weight: bold;
        padding: 10px 3px !important;
        font-size: 15px;
    }
    
    #tbl-votes .order-controls {
        width: 60px !important;
        min-width: 60px;
        max-width: 60px;
        padding: 4px 2px !important;
        vertical-align: middle;
    }
    
    #tbl-votes .order-controls button {
        padding: 10px 8px !important;
        font-size: 20px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        margin: 5px auto !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
        line-height: 1;
        border-radius: 6px !important;
        border-width: 2px !important;
    }
    
    #tbl-votes .order-controls .btn-move-up {
        background: #28a745 !important;
        border-color: #28a745 !important;
    }
    
    #tbl-votes .order-controls .btn-move-down {
        background: #dc3545 !important;
        border-color: #dc3545 !important;
    }
    
    #tbl-votes td:nth-child(3) {
        width: auto !important;
        min-width: 0;
        padding: 8px 6px !important;
    }
    
    #tbl-votes .vote-cell {
        width: auto !important;
        min-width: 0;
        padding: 8px 6px !important;
    }
    
    #tbl-votes .vote-group {
        margin-bottom: 5px;
        line-height: 1.3;
    }
    
    #tbl-votes .vote-cell label {
        display: inline-block;
        margin: 3px 4px 3px 0;
        padding: 8px 12px;
        min-width: 42px;
        min-height: 40px;
        text-align: center;
        border: 2px solid #2271b1;
        border-radius: 4px;
        cursor: pointer;
        font-size: 15px;
        font-weight: bold;
        box-sizing: border-box;
        line-height: 1.2;
        background: #fff;
    }
    
    #tbl-votes .vote-cell input[type="radio"]:checked + label {
        background: #2271b1;
        color: #fff;
    }
    
    #tbl-votes .vote-cell input[type="radio"] {
        width: 20px;
        height: 20px;
        margin: 0 5px 0 0;
        vertical-align: middle;
    }
    
    #tbl-votes .vote-comment {
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 6px;
        padding: 10px;
        font-size: 16px;
        min-height: 42px;
        box-sizing: border-box;
    }
    
    #tbl-votes strong {
        display: block;
        margin-bottom: 4px;
        font-size: 14px;
        line-height: 1.3;
    }
    
    #tbl-votes small {
        display: block;
        margin-top: 4px;
        font-size: 13px;
        line-height: 1.3;
    }
    
    #tbl-votes .own-clue-message {
        display: block !important;
        margin-top: 4px;
        font-size: 13px;
        font-weight: bold;
    }
    
    /* Clues page form */
    #accwc-clue-form table td:first-child {
        width: 100%;
        padding-bottom: 5px;
        font-weight: bold;
    }
    
    #accwc-clue-form table td:last-child {
        width: 100%;
        padding-top: 0;
    }
    
    /* Leaderboard table */
    .accwc-table.leaderboard-table td:before {
        content: attr(data-label);
    }
    
    /* Results page */
    .results-table td:before {
        content: attr(data-label);
    }
    
    /* Text adjustments */
    .text-center {
        text-align: left !important;
    }
    
    /* Small text adjustments */
    small {
        font-size: 14px;
        display: block;
        margin-top: 6px;
        line-height: 1.4;
    }
    
    /* General text size increase */
    body.accwc-page {
        font-size: 16px;
        line-height: 1.6;
    }
    
    body.accwc-page p {
        font-size: 16px;
        line-height: 1.6;
        margin-bottom: 12px;
    }
}

/* Very small screens (phones in portrait) */
@media screen and (max-width: 480px) {
    .accwc-header h1 {
        font-size: 1.6em;
    }
    
    .accwc-table:not(#tbl-votes) td {
        padding-left: 35%;
        font-size: 14px;
    }
    
    .accwc-table:not(#tbl-votes) td:before {
        font-size: 14px;
        width: 32%;
    }
    
    #tbl-votes {
        font-size: 15px;
    }
    
    #tbl-votes thead th {
        font-size: 14px;
        padding: 10px 4px !important;
    }
    
    #tbl-votes td {
        padding: 10px 4px !important;
        font-size: 14px;
    }
    
    #tbl-votes .row-number {
        width: 35px !important;
        min-width: 35px;
        max-width: 35px;
        font-size: 15px;
    }
    
    #tbl-votes .order-controls {
        width: 55px !important;
        min-width: 55px;
        max-width: 55px;
    }
    
    #tbl-votes .order-controls button {
        padding: 8px 6px !important;
        font-size: 18px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }
    
    #tbl-votes .vote-cell label {
        padding: 8px 12px;
        font-size: 15px;
        min-width: 40px;
        min-height: 40px;
    }
    
    #tbl-votes strong {
        font-size: 14px;
    }
    
    #tbl-votes small {
        font-size: 13px;
    }
    
    #vote-counter-bar {
        font-size: 16px;
        padding: 12px 8px;
    }
    
    #vote-counter-bar #points-value,
    #vote-counter-bar #clues-value {
        font-size: 20px;
    }
}

/* Tablet styles (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .accwc-container {
        padding: 10px;
    }
    
    .accwc-nav .btn {
        display: inline-block;
        width: auto;
        margin-right: 10px;
        margin-bottom: 10px;
    }
    
    .accwc-table {
        font-size: 14px;
    }
    
    .accwc-table th,
    .accwc-table td {
        padding: 8px;
    }
}

/* Touch-friendly improvements for all devices */
@media (hover: none) and (pointer: coarse) {
    /* Devices with touch screens */
    .btn,
    .accwc-nav .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    input[type="radio"],
    input[type="checkbox"] {
        width: 24px;
        height: 24px;
        margin: 10px 5px;
    }
    
    label {
        padding: 10px;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

