/* --- Admin Section Layout --- */
.admin-section {
    padding-top: 100px;
    padding-bottom: 80px;
    min-height: 80vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 15px;
}

.admin-title {
    margin: 0;
    color: var(--primary);
}

.admin-welcome-text {
    font-size: 1.1rem;
    color: #555;
    margin: 0;
}

/* --- Toolbar (Header + Button Row) --- */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* --- Password Toggle Icon Styles --- */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding: 10px 40px 10px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: color 0.2s;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Hide the eye-off icon by default */
.password-toggle .eye-off {
    display: none;
}

/* When password is visible, hide open eye and show closed eye */
.password-toggle.visible .eye-open {
    display: none;
}

.password-toggle.visible .eye-off {
    display: block;
}

/* --- Lottery Table Styles --- */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin: auto;
    max-width: 770px;
}

.loto-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.loto-table th {
    background-color: #f8f9fa;
    padding: 5px;
    border-bottom: 1px solid #ddd;
    color: #333;
    font-weight: 600;
    text-align: left;
}

.loto-row {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.loto-row:hover {
    background-color: #fcfcfc;
}

.loto-row:last-child {
    border-bottom: none;
}

.loto-cell {
    padding: 5px;
    vertical-align: middle;
    font-size: 10px;
    text-align: left;
}

.loto-cell-id {
    font-weight: bold;
    color: var(--primary);
}

.loto-actions {
    display: flex;
    gap: 8px;
}

/* --- Modal Styles --- */
.modal-demo {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.lottery-form {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-empty-state {
    text-align: center;
    color: #777;
    margin-top: 40px;
    display: none;
    font-style: italic;
}

.admin-link-input {
    background: #f8f9fa;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    color: #333;
}

.admin-input-full {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    color: var(--primary);
    font-size: 1.1rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* --- Mobile Responsiveness (max-width: 768px) --- */
@media (max-width: 768px) {
    .loto-table, .loto-table tbody {
        display: block;
        width: 100%;
    }

    /* Keep the header visible on mobile */
    .loto-table thead {
        display: block;
    }

    .loto-table thead tr {
        display: flex;
        background-color: #f8f9fa;
        border-bottom: 1px solid #ddd;
        padding: 8px 10px;
        gap: 8px;
    }

    .loto-table th {
        text-align: left;
        font-size: 11px;
        padding: 0;
        font-weight: 600;
    }

    /* Set specific widths for each header to match data layout */
    .loto-table th:nth-child(1) { flex: 0 0 30px; } /* No */
    .loto-table th:nth-child(2) { flex: 0 0 50px; } /* ID */
    .loto-table th:nth-child(3) { flex: 1; } /* Start */
    .loto-table th:nth-child(4) { flex: 1; } /* End */
    .loto-table th:nth-child(5) { flex: 0 0 70px; } /* Status */

    /* Hide the empty last header column on mobile */
    .loto-table th:last-child {
        display: none;
    }

    .loto-row {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 20px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        gap: 8px;
        align-items: center;
    }

    /* Container for data cells - match header widths */
    .loto-cell:not(.loto-actions) {
        display: inline-block;
        padding: 2px 4px;
        font-size: 11px;
        border: none;
        white-space: nowrap;
    }

    /* Match the header column widths */
    .loto-cell:nth-child(1) { flex: 0 0 30px; } /* No */
    .loto-cell:nth-child(2) { flex: 0 0 50px; } /* ID */
    .loto-cell:nth-child(3) { flex: 1; } /* Start */
    .loto-cell:nth-child(4) { flex: 1; } /* End */
    .loto-cell:nth-child(5) { flex: 0 0 70px; } /* Status */

    /* Remove separators since we're using flex alignment */
    .loto-cell:not(.loto-actions)::after {
        content: none;
    }

    /* The action buttons row */
    .loto-actions {
        display: flex;
        justify-content: flex-end; 
        gap: 8px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #eee;
        width: 100%;
        flex: 0 0 100%;
    }

    .btn-action-finish, .btn-action-change, .btn-action-delete {
        flex: 0 1 auto;
        min-width: 80px;
        padding: 8px;
    }
}